Q: Angular directive scope value   <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 be   templateUrl: '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..?

A: templateUrl: function(elem,attrs) {
    return "tab/" + attrs.page + ".html" || 'tab/default.html';
},


A: contactBook.directive('tab', function() {
    let m = 'tab/default.html';
    return {
        restrict: 'E',
        scope: {
            page: '@',
        },
        templateUrl: m,
        link: function(element, attributes) {
            m = "tab/" + attributes.page + ".html";    // attributes.page can access attribute value
        },
    };
});

You are isolating scope for tab directive and you have a binding
 scope: {
          page: '@',
     }

if your are passing just a string on parent scope to directive then use
<tab page={{book}}> </tab>

but if you want to pass an object from parent scope to directive then
<tab page="book"> </tab>

then in your directive 
  scope: {
              page: '=',
         }

