Is it possible to compile a modified directive template without using transclusion?

后端 未结 2 407
醉话见心
醉话见心 2021-01-06 11:15

I have been trying to use transclusion to create a directive which makes two copies of it\'s contents and appends them inside the original template. I have failed in my atte

2条回答
  •  醉梦人生
    2021-01-06 11:43

    This plunker was prior to Angular 1.5 which introduce Tranclusion.

    link: function(scope, element) {
          if (!element.find('ng-transclude').children().length) {
            element.find('button').append('Button1');
          }
        }
    

    Plunker

提交回复
热议问题