I am trying to create a directive that add lots of html when user clicks a button.
angular.module('myApp').directive('testProduct', function() {
return {
restrict: 'A',
link: function(scope, elem) {
var html;
html = '<div>… a lot of html tags and contents………….';
// a lot of html tags
//I want to link to a html file like product.html
//instead of defining here.
elem.bind('click', function() {
$('.product').remove();
elem.closest('div').append(html);
})
}
};
}
);
Is there anyway I can link the html to another file? like templateUrl:product.html? I can't use it here because I only want to add those html when user clicks a button.
Thanks a lot!