-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Conversation
feat(ngRoute): change This change adds a new event on ngRoute called beforeRouteChange. With this change it is possible to cancel a locationChange based on route data. The problem that I am trying to fix here is described in #5581
I'm sorry, but I wasn't able to verify your Contributor License Agreement (CLA) signature. CLA signature is required for any code contributions to AngularJS. Please sign our CLA and ensure that the CLA signature email address and the email address in this PR's commits match. If you signed the CLA as a corporation, please let us know the company's name. Thanks a bunch! PS: If you signed the CLA in the past then most likely the email addresses don't match. Please sign the CLA again or update the email address in the commit of this PR. |
I have a working implementation of this in #5714 --- If you're interested in this behaviour, you could implement a similar strategy and we could merge your version instead. I think there are still a couple of minor issues with it, so it could be some time before it gets the proper review treatment |
02dc2aa
to
fd2d6c0
Compare
no cla + the solution is not right because it relies on brittle combination of info from two events. |
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, 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
feat(ngRoute): change
This change adds a new event on ngRoute called beforeRouteChange. With this change it is possible to cancel a locationChange based on route data. The problem that I am trying to fix here is described in #5581