When I click on a tab, the corresponding controller gets executed 4 times. Whys that?
E.g. DetailsPersonController
's init
function is executed 4 times. Should only be exectuted once the tab's view gets loaded.
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"
}
}
} )