I have the following state configuration. How can I get id
parameters in index
state @
view so that it could be accessible by both, left
and detail
views controllers? Now if I try to access it via $state.params.id
it is undefined, but if I console.log($state)
I can see the parameter in my console. I only need the parameter if available on first load of left view.
$stateProvider
.state('index', {
url: '/',
views: {
'@' : {
template: '/**/'
resolve: {
params: function ($state) {
return $state.params.id;
}
}
},
'left@index' : {
template: '/**/',
controller: 'AppController',
controllerAs: 'app'
},
'main@index' : {
template: '/**/'
}
})
.state('index.detail', {
url: '/:id',
views: {
'detail@index' : {
template: '/**/',
controller: 'DetailController',
controllerAs: 'detail',
}
}
});