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:

        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?

asked Oct 6, 2015 by shegokar.anjeet
0 votes

Related Hot Questions

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.