When I click on the tab, the corresponding controller starts 4 times. What is it?
eg. The DetailsPersonController init function is executed 4 times. It should only be set after loading the tab.
HTML Tabs:
<tabset> <tab ng-repeat="tab in vm.tabs()" heading="{{ tab.text | translate }}" ui-sref="p.search.details.{{ tab.id }}" active="tab.active"> <div ui-view="tabContent"></div> </tab> </tabset>
States:
.state( "p.search.details", { url: "/details", abstract: true, templateUrl: "app/modules/partials/p/search/details/details.html", controller: "DetailsController", controllerAs: "vm" } ) .state( "p.search.details.person", { url: "/person", views: { "tabContent": { templateUrl: "app/modules/partials/p/search/details/person/person.html", controller: "DetailsPersonController", controllerAs: "vm" } } } ) .state( "p.search.details.details", { url: "/details", views: { "tabContent": { templateUrl: "app/modules/partials/p/search/details/details/details.html", controller: "DetailsDetailsController", controllerAs: "vm" } } } ) .state( "p.search.details.driver", { url: "/driver", views: { "tabContent": { templateUrl: "app/modules/partials/p/search/details/driver/driver.html", controller: "DetailsDriverController", controllerAs: "vm" } } } ) .state( "p.search.details.tests", { url: "/tests", views: { "tabContent": { templateUrl: "app/modules/partials/p/search/details/tests/tests.html", controller: "DetailsTestsController", controllerAs: "vm" } } } )
source share