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

$route should allow canceling the navigation #592

Closed
vojtajina opened this issue Oct 13, 2011 · 7 comments
Closed

$route should allow canceling the navigation #592

vojtajina opened this issue Oct 13, 2011 · 7 comments

Comments

@vojtajina
Copy link
Contributor

we need api for allowing that during $beforeRouteChange event.

With new $location is easy, as we can revert $location and then it will never be propagated into browser.

The difficult part is, if we want to allow canceling route change which was triggered by browser (user has typed different url).
The same propblem is when using hashbang mode, then clicking any link means updating the browser's address bar first...

@DanWahlin
Copy link

Definitely agree with adding something like a $beforeRouteChange or $beforeRouteChangeStart event. $locationChangeStart works (although hitting the back button only works with the fix to $location mentioned here: #2109), it seems much more intuitive for $route to handle notifying before a route changes and allowing it to be cancelled since we already have $routeChangeStart and $routeChangeSuccess.

@sylvain-hamel
Copy link

This commit adds support for preventDefault() on the $routeChangeStart event.

Commit : sylvain-hamel@f8ac46e

Any comment?

@btford
Copy link
Contributor

btford commented Aug 24, 2013

As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months.

Please try the newest versions of Angular (1.0.8 and 1.2.0-rc.1), and if the issue persists, comment below so we can discuss it.

Thanks!

@WhatFreshHellIsThis
Copy link

Using latest angular $routeChangeStart event parameter has preventDefault() method which apparently does absolutely nothing. It also peculiarly has a property: defaultPrevented which is always false and if set to true also does absolutely nothing. Not sure why this was closed since it doesn't appear to be implemented or perhaps something else broke it (no regression tests?).

@geddski
Copy link
Contributor

geddski commented May 22, 2014

reopening since this was never resolved, but a solution is provided by #4192

@gkalpak
Copy link
Member

gkalpak commented Oct 14, 2014

@Nerretz: I think f4ff11b closes this issue, right ?

@pkozlowski-opensource
Copy link
Member

@gkalpak yup, you are right. Thnx!

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

No branches or pull requests

9 participants