创建了这个简单的测试用例,显示发生的错误:
<tabset ng-repeat="tab in tabs">
<tab heading="{{tab.title}}">
<i ng-class="name_to_class[tab.title]"></i>{{tab.title}}
</tab>
<tab active="tab.active" disabled="tab.disabled">
<ul class="list-group">
<li class="list-group-item" ng-repeat="c in tab.content">{{ c }}</li>
</ul>
</tab>
</tabset>
var TabsDemoCtrl = function ($scope) {
$scope.name_to_class = {'Dynamic Title 1': 'pull-right', // icons in real-code
'Dynamic Title 2': 'pull-right'};
$scope.tabs = [
{ title:'Dynamic Title 1', content:['foo', 'bar'] },
{ title:'Dynamic Title 2', content:['can', 'haz'] }
];
};
答案 0 :(得分:0)
您不能将ng-repeat
放在tabset
上docs)
将ng-repeat
放在tab
<强> plnkr 强>
<tabset>
<tab ng-repeat="tab in tabs" heading="{{tab.title}}" active="tab.active" disabled="tab.disabled" ng-class="name_to_class[tab.title]">
<ul class="list-group">
<li class="list-group-item" ng-repeat="c in tab.content">{{ c }}</li>
</ul>
</tab>
</tabset>
答案 1 :(得分:0)
试试这个。 你需要重复标签而不是标签集吗?
<tabset >
<tab ng-repeat ="tab in tabs" heading='{{tab.title}}'>
<ul class = "list-group" >
<li class = "list-group-item" ng-repeat='c in tab.content'> {{c}}
</ul>
</tab>
</tabset>