angular-ui tabs在tab-content中加载模板

Yah*_*CEM 11 angularjs angular-ui

我正在使用此控制器在angular-ui中使用选项卡:

$scope.panes = [
    { title:"Home",      content:"home" , active: true},
    { title:"Settings",  content:"settings"},
    { title:"View",      content:"view"}
];
Run Code Online (Sandbox Code Playgroud)

这在html文件中:

<tabs>
    <pane
      active="pane.active"
      heading="{{pane.title}}"
      ng-repeat="pane in panes"
    >
      {{pane.content}}
    </pane>
  </tabs>
Run Code Online (Sandbox Code Playgroud)

但我想将内容设置为模板我该怎么做,我尝试在这个plunker中设置ng-include代码,但是没有用.
提前致谢.

更新:

如果您找到此解决方案并且您没有使用angular-bootstrap v0.12,则需要将代码更新为v0.13的新语法,如下所示:

<tabset>
    <tab
      active="pane.active"
      heading="{{pane.title}}"
      ng-repeat="pane in panes"
    >
      <div ng-include="pane.content"></div>
    </tab>
  </tabset>
Run Code Online (Sandbox Code Playgroud)

我已经更新了plunker以获得angular-bootstrap v0.13的语法.

Liv*_* T. 25

只需将ng-include添加为窗格的子项即可

<tabs>
    <pane active="pane.active"
          heading="{{pane.title}}"
          ng-repeat="pane in panes">
        <div ng-include="pane.content"></div>
    </pane>
</tabs>
Run Code Online (Sandbox Code Playgroud)

这样做的原因是,当您在与创建窗格变量的ng-repeat相同的元素中使用ng-include时,范围变量窗格尚不可用.

这是因为ng-include的优先级值为0(默认值),而ng-repeat的优先级为1000,因此执行顺序为:

  1. NG-包括
  2. NG-重复

请参阅指令文档