I have the following nested routes in my Angular app:
.state('mapping', {
url: '/mapping',
templateUrl: 'app/components/mapping/mapping.html',
controller: 'MapCtrl as map',
abstract: true,
authenticate: true
})
.state('mapping.all', {
url: '',
templateUrl: 'app/components/mapping/partials/all.html',
authenticate: true
})
.state('mapping.project', {
url: '/:projectName',
controller: 'ProjectCtrl as proj',
templateUrl: 'app/components/mapping/partials/project.html',
authenticate: true
})
When accessing 'mapping.project'
, ProjectCtrl
never gets loaded. Instead, MapCtrl
is loaded as if I was still on the parent state.
How can I override the parent controller with another controller that is specific to that child state?
I want this controller to get loaded every time I access that specific child state, which just won't happen if I have a single parent controller for every child state.