<tab page="book"> </tab>
<tab page="dial"> </tab>
<tab page="groupe"> </tab>
<tab page="log"> </tab>
<tab page="star"> </tab>
As you can see i have a directive named tab, and this tab have an attribute page,
i need to change the templateUrl based on the value of page attribute
if the page value is
page="abc"
then the templateUrl should betemplateUrl: 'tab/abc.html',
here is my directive code
contactBook.directive('tab', function() {
let m = 'tab/default.html';
return {
restrict: 'E',
scope: {
page: '@',
},
templateUrl: m,
link: function(scope, element, attributes) {
m = "tab/" + scope.page + ".html";
},
};
});
is this logically possible..? or any alternative methode to done this..?
templateUrl: function(elem,attrs) {
return "tab/" + attrs.page + ".html" || 'tab/default.html';
},