@@ -265,7 +265,7 @@ function $UrlRouterProvider( $locationProvider, $urlMatcherFactory) {
265
265
$get . $inject = [ '$location' , '$rootScope' , '$injector' , '$browser' ] ;
266
266
function $get ( $location , $rootScope , $injector , $browser ) {
267
267
268
- var baseHref = $browser . baseHref ( ) , location = $location . url ( ) ;
268
+ var baseHref = $browser . baseHref ( ) , location = $location . url ( ) , lastPushedUrl = undefined ;
269
269
270
270
function appendBasePath ( url , isHtml5 , absolute ) {
271
271
if ( baseHref === '/' ) return url ;
@@ -277,6 +277,9 @@ function $UrlRouterProvider( $locationProvider, $urlMatcherFactory) {
277
277
// TODO: Optimize groups of rules with non-empty prefix into some sort of decision tree
278
278
function update ( evt ) {
279
279
if ( evt && evt . defaultPrevented ) return ;
280
+ if ( lastPushedUrl && $location . url ( ) === lastPushedUrl )
281
+ return lastPushedUrl = undefined ;
282
+ lastPushedUrl = undefined ;
280
283
281
284
function check ( rule ) {
282
285
var handled = rule ( $injector , $location ) ;
@@ -349,6 +352,7 @@ function $UrlRouterProvider( $locationProvider, $urlMatcherFactory) {
349
352
350
353
push : function ( urlMatcher , params , options ) {
351
354
$location . url ( urlMatcher . format ( params || { } ) ) ;
355
+ lastPushedUrl = options && options . $$avoidResync ? $location . url ( ) : undefined ;
352
356
if ( options && options . replace ) $location . replace ( ) ;
353
357
} ,
354
358
0 commit comments