Angularjs templateUrl fails to bind attributes inside ng-repeat

后端 未结 5 1203
时光取名叫无心
时光取名叫无心 2020-12-20 01:59

I\'m using directive to display html snippets.

And templateUrl inside the directive, to be able to include snippets as html file.

The directive does not wor

5条回答
  •  误落风尘
    2020-12-20 02:23

    attrs param for templateUrl is not interpolated during directive execution. You may use the following way to achieve this

    app.directive("myTemplate", function() {
      return {
        restrict: 'EA',
        replace: false,
        scope: { snippet: '@'},
        template: '
    ' }; });

    Demo: http://plnkr.co/edit/2ofO6m45Apmq7kbYWJBG?p=preview

提交回复
热议问题