Angular Directive Different Template

前端 未结 6 1705
渐次进展
渐次进展 2020-12-07 20:51

I have a directive myDirective with variable type. If I run I want the directive to use templateUrl: x-template.html. If I do <

6条回答
  •  半阙折子戏
    2020-12-07 21:28

    You can work around this issue using ng-include inside compile:

    app.directive('myDirective', function() {
        return {
            restrict: 'E',
            compile: function(element, attrs) {
                element.append('
    '); } } });

    fiddle

提交回复
热议问题