Skip to content

$stateParams and $state.params do not match inside a resolve #360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ProLoser opened this issue Aug 27, 2013 · 2 comments
Closed

$stateParams and $state.params do not match inside a resolve #360

ProLoser opened this issue Aug 27, 2013 · 2 comments

Comments

@ProLoser
Copy link
Member

Topic.

I am trying to query information and found that $stateParams carries the proper information, but $state.params does not. This is not a big deal but I found it an unpredictable behavior. The REASON I opt to inject $state instead of $stateParams is because if the query fails I'd like to push the user to a different state instead.

I may be slightly noobish in that I'm not entirely sure what occurs when a resolve-promise gets rejected. Is there a way to specify a new route/state to switch to? I'm okay with doing it programmatically, I just was wondering what the standard Angular behavior was anyway.

@nateabele
Copy link
Contributor

The reasons here are largely the same as your previous issue, and in your case here you should actually inject both.

With regard to rejected transitions, there are two possible paths: either a transition is rejected outright, in which case you don't go anywhere (the current state is retained), or, it can be superseded by a new transition that goes somewhere else entirely (i.e. by calling $state again).

@nateabele
Copy link
Contributor

See #238.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants