I am creating tabs using AngularStrap and would like to dynamically load an html fragment for each as shown in the following questions, but also would like to specify a dynamic controller.
See: AngularStrap tabs load html fragment
Here are my javascript and 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>
The dynamic pages work fine, but the controllers not only don't work but they also prevent dynamic fragments from being loaded. Do angular strap tabs support this behavior? Thanks in advance.