@@ -265,7 +265,7 @@ function $UrlRouterProvider( $locationProvider, $urlMatcherFactory) {
265265 $get . $inject = [ '$location' , '$rootScope' , '$injector' , '$browser' ] ;
266266 function $get ( $location , $rootScope , $injector , $browser ) {
267267
268- var baseHref = $browser . baseHref ( ) , location = $location . url ( ) ;
268+ var baseHref = $browser . baseHref ( ) , location = $location . url ( ) , lastPushedUrl = undefined ;
269269
270270 function appendBasePath ( url , isHtml5 , absolute ) {
271271 if ( baseHref === '/' ) return url ;
@@ -277,6 +277,9 @@ function $UrlRouterProvider( $locationProvider, $urlMatcherFactory) {
277277 // TODO: Optimize groups of rules with non-empty prefix into some sort of decision tree
278278 function update ( evt ) {
279279 if ( evt && evt . defaultPrevented ) return ;
280+ if ( lastPushedUrl && $location . url ( ) === lastPushedUrl )
281+ return lastPushedUrl = undefined ;
282+ lastPushedUrl = undefined ;
280283
281284 function check ( rule ) {
282285 var handled = rule ( $injector , $location ) ;
@@ -349,6 +352,7 @@ function $UrlRouterProvider( $locationProvider, $urlMatcherFactory) {
349352
350353 push : function ( urlMatcher , params , options ) {
351354 $location . url ( urlMatcher . format ( params || { } ) ) ;
355+ lastPushedUrl = options && options . $$avoidResync ? $location . url ( ) : undefined ;
352356 if ( options && options . replace ) $location . replace ( ) ;
353357 } ,
354358
0 commit comments