You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ui-router lifecycle is exhibiting a behavior that, in my opinion, is unintuitive. Inside of an onEnter function, if you try to inject $stateParams into a function you get the parameters from the previous state -- this is the same behavior you see if you try to inject $stateParams into a ui-bootstrap modal resolve function. Wrapping the invocation in a $timeout will defer the execution until the state changes, but I don't think this should be necessary. For example:
I also created a minimal Plunker that exhibits this behavior.
I believe that the expected behavior would be when injecting $stateParams from within an onEnter callback, it would resolve to the params of the state being entered. Is this something that can be accommodated? The $timeout workaround seems kludgy to me and I'd rather not rely on it.
No, the same behavior occurs with non-nested sibling states. I can't think of a reason why you wouldn't expect the current state's params to be injected when inside of onEnter.
The ui-router lifecycle is exhibiting a behavior that, in my opinion, is unintuitive. Inside of an
onEnter
function, if you try to inject$stateParams
into a function you get the parameters from the previous state -- this is the same behavior you see if you try to inject$stateParams
into a ui-bootstrap modalresolve
function. Wrapping the invocation in a$timeout
will defer the execution until the state changes, but I don't think this should be necessary. For example:I also created a minimal Plunker that exhibits this behavior.
I believe that the expected behavior would be when injecting
$stateParams
from within anonEnter
callback, it would resolve to the params of the state being entered. Is this something that can be accommodated? The$timeout
workaround seems kludgy to me and I'd rather not rely on it.For background, I'm creating this issue as a follow-on to my StackOverflow question.
The text was updated successfully, but these errors were encountered: