我正在使用AngularStrap创建标签,并希望为每个标签动态加载一个html片段,如下面的问题所示,但也想指定一个动态控制器。
请参阅:AngularStrap tabs load html fragment
这是我的javascript和html。
function WorkspaceCtrl($scope, $window, $location) {
// Tab directive
$scope.tabs = [
{
title:'Search',
page: 'templates/workspace/search.ejs',
controller: SearchCtrl
},
{
title:'My Searches',
page: 'templates/workspace/my_searches.ejs',
controller: MySearchesCtrl
},
{
title:'Community Searches',
page: 'templates/workspace/community_searches.ejs',
controller: CommunitySearchesCtrl
}
];
$scope.tabs.activeTab = 1;
}
<body ng-controller="WorkspaceCtrl">
<div class="container">
<section id="tab">
<div class="bs-docs-example">
<div ng-model="tabs.activeTab" bs-tabs>
<div ng-repeat="tab in tabs" data-title="{{ tab.title }}">
</div>
<div ng-include src='tabs[tabs.activeTab].page' ng-controller="tabs[tabs.activeTab].controller"></div>
</div>
</div>
</section>
</div>
</body>
动态页面工作正常,但控制器不仅不起作用,而且还阻止加载动态片段。角带标签是否支持此行为?提前谢谢。