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

$route should allow canceling the navigation #592

Description

@vojtajina

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...

Activity

  1. DanWahlin commented on Apr 13, 2013

    @DanWahlin

    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.

  2. sylvain-hamel commented on Apr 23, 2013

    @sylvain-hamel

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

    Commit : sylvain-hamel@f8ac46e

    Any comment?

  3. btford commented on Aug 24, 2013

    @btford
    Contributor

    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!

  4. WhatFreshHellIsThis commented on Oct 15, 2013

    @WhatFreshHellIsThis

    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?).

  5. geddski commented on May 22, 2014

    @geddski
    Contributor

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

  6. added this to the milestone on Jul 2, 2014
  7. gkalpak commented on Oct 14, 2014

    @gkalpak
    Member

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

  8. pkozlowski-opensource commented on Oct 14, 2014

    @pkozlowski-opensource
    Member

    @gkalpak yup, you are right. Thnx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions