I am using UI router to define several states and their child views. I set their controllers accordingly as well.
I'd like one or more of those controllers to be active before the view is loaded, because of data fetching and some other operations.
Is this possible? Is this a good/bad idea?
.state(stateNames.MY_STATE, {
url: '/products/:view',
views: {
'items-of-count@my.state': {
templateUrl: 'path/to/template.html',
controller: 'NotYetLoadedController'
},
'selected-items-count@my.state': {
templateUrl: 'path/to/this/template.html',
controller: 'NotYetLoadedController'
}
},
params: {
view: {
squash: true
}
}
})