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.

$locationChangeSuccess not fires with browser back and hash is empty #12175

Closed
@fspezi

Description

@fspezi

I am using angular 1.3.16, in Google Chrome.
I found a wrong behavior of $locationChangeSuccess event.

To reproduce:

  • open a page like "path/#"
  • click to a link to go to a page like "path/#arg=123"
  • click to a link to go to a page like "path/#arg=555"
  • now, click to "Back" button of browser. You will go to "path/#arg=123"; $locationChangeSuccess event is fires.
  • click another time to "Back" button of browser. You will go to "path/#"; sometimes, $locationChangeSuccess event is NOT fired ($locationChangeStart is fired).
  • click to "foreward" button of browser. You will go to "path/#arg=123"; $locationChangeSuccess is fired.
  • click to "back" button of browser. You will go to "path/#"; $locationChangeSuccess is NOT fired.

I found in "angular.js" source code that there is a comparison between $location.absUrl() and newUrl local variable. $location.absUrl() returns "path/", and newUrl returns "path/#".
Row 11486: if ($location.absUrl() !== newUrl) return;

This comparison is made after "$locationChangeStart" and before "$locationChangeSuccess". The comparison do exit by function.

The $succes

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions