Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

feat(ngRoute): allow cancelling $route updates via $routeChangeEvent #9407

Closed
wants to merge 2 commits into from

Conversation

caitp
Copy link
Contributor

@caitp caitp commented Oct 3, 2014

Previously, one could perform this feat by listening to both
$locationChangeStart as well as $routeChangeStart, and being careful to
update the route correctly. Now, it's possible to simply preventDefault()
on the
$beforeRouteChange event in order to prevent location and route from being
updated.

While this does not cancel $routeChangeStart, it does ensure that the
correct location is restored, and provides the same information as
$routeChangeStart.

Closes #5855
Closes #5714
Closes #5581

caitp added 2 commits October 2, 2014 21:54
Previously, one could perform this feat by listening to both
$locationChangeStart as well as $routeChangeStart, and being careful to update
the route correctly. Now, it's possible to simply preventDefault() on the
$beforeRouteChange event in order to prevent location and route from being
updated.

While this does not cancel $routeChangeStart, it does ensure that the correct
location is restored, and provides the same information as $routeChangeStart.

Closes angular#5855
Closes angular#5714
Closes angular#5581
Previously, this was asserting that $beforeRouteChange was never called.
Prior to the preceeding commit, $beforeRouteChange didn't exist ---
however it is called during $locationChangeStart.

It looks like this test should be asserting that $routeChangeStart is
never fired.
@caitp
Copy link
Contributor Author

caitp commented Oct 3, 2014

@IgorMinar updated based on discussion, LGTY? it fixes a broken assertion in a test too, which is nice

@tbosch
Copy link
Contributor

tbosch commented Oct 9, 2014

@caitp Sorry, we didn't see it as it missed the milestone...

Closing as already implemented via f4ff11b

@tbosch tbosch closed this Oct 9, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to cancel $routeChangeStart event
4 participants