in my routes(states) config I have:
state('users', {
abstract:true,
templateUrl: '/path/to/template.html',
access: { isPrivate: 0 },
resolve: {
...a resolve block..
}).state('users.me',{
url: '/users/:id/',
controller: 'userCtrl',
access: { isPrivate: 0 },
views:{
'userView':{
templateUrl:'/path/to/template.html'',
controller:'userCtrl',
},
'view1':{
templateUrl:'/path/to/template.html'',
controller:'anotherCtrl',
},
'view2':{
templateUrl:'/path/to/template.html'',
controller:'anotherCtrl',
},
'view3':{
templateUrl:'/path/to/template.html'',
controller:'anotherCtrl',
},
'view4':{
templateUrl:'/path/to/template.html',
controller:'anotherCtrl'
}
}
In the resolve for this view I have:
user: function (Restangular, tokenService, $q,$stateParams) {
var token = tokenService.getAccessToken();
console.log('params',$stateParams) //logs an empty object
return Restangular.one('users',($stateParams.id || "me")).get({ header:header });
}
but for some reason, even if change the url to /users/5/ the resolve functions (that should resolve the correct data for the user) get an empty $stateParams.id and auto resolves to the default 'me'.
What am I missing? I'll be glad for help with this!