-
Notifications
You must be signed in to change notification settings - Fork 3k
No way to be informed of state change cancellations #1823
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
Comments
In the current version of your plunker, the B route's resolve promise is not returned properly. I fixed it and decreased the delay to 4 seconds: http://embed.plnkr.co/2NII1wpsErGAtahUUtia/preview I am facing the same issue. In our project, we display a loader on Here is an additional jsfiddle: http://jsfiddle.net/7d64zx1e/ |
We recently merged #1844. That might fix it for you. |
Thank you, it's fixed ;) |
@zhouzi How? I used the latest release. Is $stateChangeCancel firing for you? |
I don't think it has been released yet but there's just a line to copy and paste if you need it right now: https://github.com/angular-ui/ui-router/pull/1844/files#diff-230fff7c0b3ed8f0d4f2443a246fc76aR1031 This is what I did and it works as expected. |
@zhouzi I did but still $stateChangeCancel isn't firing. Here's a plunk: http://plnkr.co/edit/3bxakVKotEeIDVF7eBlw In my case I'm not doing event.preventDefault(). Is that why? |
I can't get your plunker to work, the assets are not loaded properly (looks like there is an issue relative to plunker). Did you try it locally? On my side, I do receive the |
@zhouzi I Yeah I tried locally. Didn't work. |
Actually a I have uploaded a demo of the |
Then what is the use of #1844? We know when we use event.preventDefault(). |
You know it as a developer but you still need to publish an event for the modules listening to |
Oh I see. |
@arjun-u Your plunk is using the release version, which does not contain the patch. You need to clone master and build from source. |
@nateabele the plunk is not using the release version. I've added a script file "ui-router" with the patch. Please check again. And how can you close the issue when an another person is saying as well that it's not working? It's not working because I'm not explicitly calling |
If http://plnkr.co/edit/3bxakVKotEeIDVF7eBlw is the plunkr you're talking about, I can't even get it to run. It fails with: |
@nateabele I'm sorry something is wrong with Plunkr editor. It's not loading script files after you edit a saved Plunk. I've no idea why. I created a new one: http://plnkr.co/ilpXLe7dJN8MU9TY7i11 This Plunk is working, but if you click launch in editor it is not loading script/css files and throws the same error. Please check this. Thanks. |
Immediately I click on another button to go to state A (B has some stuff to resolve, so there's time before B's UI actually starts loading)
I agree that this is expected behaviour but I'd like to know a state change was cancelled. $stateChangeError isn't fired either.
Imagine I was showing a loader in $stateChangeStart and hiding it on $stateChangeSuccess. In the scenario described above, my app would think a state transition was started and then it never finished. The loader would keep on loading.
Here's a plunk: http://plnkr.co/edit/Uf3nSuOIgd6zvpIniUUY?p=preview
In the plunk I've given a timeout of 10 seconds in B's resolve. So before it resolves, click on A. The above scenario plays out. Monitor the console for state change listener events.
The text was updated successfully, but these errors were encountered: