@@ -147,7 +147,6 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
147147 if ( ! queue [ parentName ] ) {
148148 queue [ parentName ] = [ ] ;
149149 }
150-
151150 queue [ parentName ] . push ( state ) ;
152151 }
153152
@@ -164,8 +163,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
164163 if ( states . hasOwnProperty ( name ) ) throw new Error ( "State '" + name + "'' is already defined" ) ;
165164
166165 // Get parent name
167- var parentName =
168- ( name . indexOf ( '.' ) !== - 1 ) ? name . substring ( 0 , name . lastIndexOf ( '.' ) )
166+ var parentName = ( name . indexOf ( '.' ) !== - 1 ) ? name . substring ( 0 , name . lastIndexOf ( '.' ) )
169167 : ( isString ( state . parent ) ) ? state . parent
170168 : '' ;
171169
@@ -265,14 +263,19 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
265263 transition : null
266264 } ;
267265
266+ $state . reload = function reload ( ) {
267+ $state . transitionTo ( $state . current , $stateParams , { reload : true , inherit : false , notify : false } ) ;
268+ } ;
269+
268270 $state . go = function go ( to , params , options ) {
269271 return this . transitionTo ( to , params , extend ( { inherit : true , relative : $state . $current } , options ) ) ;
270272 } ;
271273
272274 $state . transitionTo = function transitionTo ( to , toParams , options ) {
273- if ( ! isDefined ( options ) ) options = ( options === true || options === false ) ? { location : options } : { } ;
274275 toParams = toParams || { } ;
275- options = extend ( { location : true , inherit : false , relative : null , notify : true , $retry : false } , options ) ;
276+ options = extend ( {
277+ location : true , inherit : false , relative : null , notify : true , reload : false , $retry : false
278+ } , options || { } ) ;
276279
277280 var from = $state . $current , fromParams = $state . params , fromPath = from . path ;
278281 var evt , toState = findState ( to , options . relative ) ;
@@ -297,8 +300,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
297300 if ( retryTransition !== $state . transition ) return TransitionSuperseded ;
298301 redirect . options . $retry = true ;
299302 return $state . transitionTo ( redirect . to , redirect . toParams , redirect . options ) ;
300- } ,
301- function ( ) {
303+ } , function ( ) {
302304 return TransitionAborted ;
303305 } ) ;
304306 syncUrl ( ) ;
@@ -325,7 +327,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
325327 // Starting from the root of the path, keep all levels that haven't changed
326328 var keep , state , locals = root . locals , toLocals = [ ] ;
327329 for ( keep = 0 , state = toPath [ keep ] ;
328- state && state === fromPath [ keep ] && equalForKeys ( toParams , fromParams , state . ownParams ) ;
330+ state && state === fromPath [ keep ] && equalForKeys ( toParams , fromParams , state . ownParams ) && ! options . reload ;
329331 keep ++ , state = toPath [ keep ] ) {
330332 locals = toLocals [ keep ] = state . locals ;
331333 }
@@ -334,7 +336,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
334336 // But clear 'transition', as we still want to cancel any other pending transitions.
335337 // TODO: We may not want to bump 'transition' if we're called from a location change that we've initiated ourselves,
336338 // because we might accidentally abort a legitimate transition initiated from code?
337- if ( to === from && locals === from . locals ) {
339+ if ( to === from && locals === from . locals && ! options . reload ) {
338340 syncUrl ( ) ;
339341 $state . transition = null ;
340342 return $q . when ( $state . current ) ;
0 commit comments