Utilizing tabs in angularjs and dynamically loading views. My goal is to prevent the re-loading of a view that has already been loaded, and to ensure that the controller does not run again when using $state.go
. Instead, it should be set to active status.
View
<tabset>
<tab ng-repeat="tab in tabs" select="go(tab.route)" ui-sref-active="tab.active"
heading="{{tab.title}}" active="tab.active" disable="tab.disabled">
<ui-view> </ui-view> </tab>
</tabset>
JS Controller
$rootScope.tabs = [ { title: 'Dashboard', route: 'store.dashboard',
active:true }, { title: 'Home', route: 'store.home' } ];
$rootScope.go = function (route) {
$state.go(route);
};