从angularjs中的嵌套子项中获取transclude槽

时间:2017-11-15 21:53:39

标签: angularjs angularjs-ng-transclude

我有一个带有两个插槽的multi-transclude指令:

myModule.directive('myDirective', function () {
    return {
        restrict: 'E',
        templateUrl: 'myTemplate.html',
        transclude: {
            'slot1': 'slot1',
            'slot2': 'slot2',
        },
...

如果我像这样使用它,它完全正常:

<my-directive>
  <slot1>Some content</slot1>
  <slot2>Some other content</slot2>
</my-directive>

但是,我需要在另一个指令中定义<slot2>

<my-directive>
  <slot1>
     some content
     <another-directive></another-directive>
  </slot1>
</my-directive>

另一个-directive.html:

<slot2>I want my-directive see this slot</slot2>

知道如何实现这一目标吗?

0 个答案:

没有答案