@@ -264,7 +264,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
264
264
$state . transitionTo = function transitionTo ( to , toParams , options ) {
265
265
if ( ! isDefined ( options ) ) options = ( options === true || options === false ) ? { location : options } : { } ;
266
266
toParams = toParams || { } ;
267
- options = extend ( { location : true , inherit : false , relative : null , $retry : false } , options ) ;
267
+ options = extend ( { location : true , inherit : false , relative : null , notify : true , $retry : false } , options ) ;
268
268
269
269
var from = $state . $current , fromParams = $state . params , fromPath = from . path ;
270
270
@@ -331,8 +331,10 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
331
331
toParams = normalize ( to . params , toParams || { } ) ;
332
332
333
333
// Broadcast start event and cancel the transition if requested
334
- evt = $rootScope . $broadcast ( '$stateChangeStart' , to . self , toParams , from . self , fromParams ) ;
335
- if ( evt . defaultPrevented ) return TransitionPrevented ;
334
+ if ( options . notify ) {
335
+ evt = $rootScope . $broadcast ( '$stateChangeStart' , to . self , toParams , from . self , fromParams ) ;
336
+ if ( evt . defaultPrevented ) return TransitionPrevented ;
337
+ }
336
338
337
339
// Resolve locals for the remaining states, but don't update any global state just
338
340
// yet -- if anything fails to resolve the current state needs to remain untouched.
@@ -394,7 +396,9 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
394
396
}
395
397
}
396
398
397
- $rootScope . $broadcast ( '$stateChangeSuccess' , to . self , toParams , from . self , fromParams ) ;
399
+ if ( options . notify ) {
400
+ $rootScope . $broadcast ( '$stateChangeSuccess' , to . self , toParams , from . self , fromParams ) ;
401
+ }
398
402
399
403
return $state . current ;
400
404
} , function ( error ) {
0 commit comments