在ng-include模板中使用ng-transclude

时间:2016-10-19 05:37:37

标签: angularjs angularjs-directive

当尝试在ng-include模板中使用ng-transclude时,会抛出以下错误,

Error: [ngTransclude:orphan] Illegal use of ngTransclude directive in the template! No parent directive that requires a transclusion found. Element: <ng-transclude>

我确实已将transclude: true包含在指令范围内,

// directive1.html
<div>
    <div ng-include="template.html">
</div>

// template.html
<div>
  <ng-transclude></ng-transclude>
</div>

0 个答案:

没有答案