fix($location): reset $location.$$replace with every watch call

Closes #1111
This commit is contained in:
Rado Kirov
2012-09-21 18:57:22 -07:00
committed by Igor Minar
parent c9199ee663
commit fc781560a3
3 changed files with 30 additions and 11 deletions

View File

@@ -590,6 +590,7 @@ function $LocationProvider(){
var changeCounter = 0;
$rootScope.$watch(function $locationWatch() {
var oldUrl = $browser.url();
var currentReplace = $location.$$replace;
if (!changeCounter || oldUrl != $location.absUrl()) {
changeCounter++;
@@ -598,12 +599,12 @@ function $LocationProvider(){
defaultPrevented) {
$location.$$parse(oldUrl);
} else {
$browser.url($location.absUrl(), $location.$$replace);
$location.$$replace = false;
$browser.url($location.absUrl(), currentReplace);
afterLocationChange(oldUrl);
}
});
}
$location.$$replace = false;
return changeCounter;
});