8000 fix($location): fix back-button not triggering $locationChangeStart by quazzie · Pull Request #2204 · angular/angular.js · GitHub
[go: up one dir, main page]

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

fix($location): fix back-button not triggering $locationChangeStart #2204

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix($location): fix back-button not triggering $locationChangeStart
$locationChangeStart does not get broadcasted when pressing the back-button.

Closes #2109
  • Loading branch information
quazzie committed Mar 22, 2013
commit ef004897170b1a637f5e34f1e304b771acd7a344
4 changes: 4 additions & 0 deletions src/ng/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,10 @@ function $LocationProvider(){
// update $location when $browser url changes
$browser.onUrlChange(function(newUrl) {
if ($location.absUrl() != newUrl) {
if ($rootScope.$broadcast('$locationChangeStart', newUrl, $location.absUrl()).defaultPrevented) {
$browser.url($location.absUrl());
return;
}
$rootScope.$evalAsync(function() {
var oldUrl = $location.absUrl();

Expand Down
0