where It should route to /users/me/
and Instead it routes to /users//
if I manually write the /users/me/
url or use a link to move there, everything works fine. but transitionTo doesn't Do what I expect and I can't figure out why.
In my code I have:
$state.transitionTo('users.me');
where 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'
}
}
I'll be glad for help with this
Make sure you provide an id.
$state.transitionTo('users.me', {'id': 'me'});
This should make it work, but you should be using the go()
method as transitionTo is a low-level function since 0.2.0.
$state.go('users.me', {'id': 'me'});
Be sure to read the method's documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With