javascript - How to make a directive for adding sections in angular at runtime based on attribute value -
i have many sections and accordingly have different code maintained in html files home.html , about.html , want make angular custom directive render @ runtime and had tried making directive works first time not when using multiple times . need making directive app.directive('mysection', function() { return { restrict: 'e', transclude:true, templateurl: function(elem,attrs) { return "sections/"+attrs.templateurl +".html" } } }); and in html writing <mysection template-url="headersection"><mysection> <mysection template-url="headersection"><mysection> try markup <mysection template-url="headersection"></mysection> <mysection template-url="headersection"></mysection> note close tag