angularjs directive set template url dynamically

后端 未结 4 2138
刺人心
刺人心 2021-02-19 22:19

I\'m creating a directive with template URL. I want to set the template URL dynamically based on user_role. Any idea?

Heres my directive code:

RatingRX.d         


        
4条回答
  •  盖世英雄少女心
    2021-02-19 22:41

    If not put it in the markup.

    angular.module("directives") .directive("headermenu", function() { return { restrict: "EA", scope: true, templateUrl: function (element, attr) { return attr.template; }, link: function(scope, iElement, iAttrs, controller) { .... } }; });

提交回复
热议问题