Organizational Research By

Surprising Reserch Topic

directive with attributes which affect template


directive with attributes which affect template  using -'angularjs,templates,directive'

I want to use the following directive.
<tabContent action="XYZ.html"> that will display me XYZ.html if the view in context is equal XYZ.
So I've created the following directive:

.directive('tabContent',function(){
        return {
            restrict: 'E',
            template:'<div ng-if="view==\'{{action}}\'" ng-include="\'{{action}}.html\'"></div>',
            link: function(scope, elem, attrs) {
                scope.action = attrs.action;
            }
        }
    })


is that the correct approach?
Thanks,
       ¬†¬†Omer
    
asked Oct 6, 2015 by shegokar.anjeet
0 votes
3 views



Related Hot Questions



Government Jobs Opening


...