I'm trying to use $transitions
service instead of $stateParams
like there for listening on state changing, but can't get state params. I'm using property of StateObject, but instead of getting for example {id: 123}
, i got {id: e}
, where e
is a object in which i can't find a value. Anybody help with this ?
$transitions.onStart({ }, function(trans) {
console.log(trans.$from().params);
}
I noticed that trans.params()
return "to" state params.
trans.$from().params
will get you from state parameters declaration.
trans.params('from')
will get you their actual values
Probably what you need is:
$transitions.onStart({ }, function(trans) {
console.log(trans.params('from'));
}
Please refer to documentation here
State params https://ui-router.github.io/ng1/docs/latest/interfaces/state.statedeclaration.html#params
Transition params https://ui-router.github.io/ng1/docs/latest/classes/transition.transition-1.html#params
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