@@ -264,7 +264,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
264264 $state . transitionTo = function transitionTo ( to , toParams , options ) {
265265 if ( ! isDefined ( options ) ) options = ( options === true || options === false ) ? { location : options } : { } ;
266266 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 ) ;
268268
269269 var from = $state . $current , fromParams = $state . params , fromPath = from . path ;
270270
@@ -331,8 +331,10 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
331331 toParams = normalize ( to . params , toParams || { } ) ;
332332
333333 // 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+ }
336338
337339 // Resolve locals for the remaining states, but don't update any global state just
338340 // yet -- if anything fails to resolve the current state needs to remain untouched.
@@ -394,7 +396,9 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
394396 }
395397 }
396398
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+ }
398402
399403 return $state . current ;
400404 } , function ( error ) {
0 commit comments