@@ -200,17 +200,16 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
200
200
} ;
201
201
202
202
$state . go = function go ( to , params , options ) {
203
- var toState = findState ( to , $state . $current ) ;
204
- params = inheritParams ( $stateParams , params || { } , $state . $current , toState ) ;
205
- return this . transitionTo ( toState , params , options ) ;
203
+ return this . transitionTo ( to , params , extend ( { inherit : true , relative : $state . $current } , options ) ) ;
206
204
} ;
207
205
208
206
$state . transitionTo = function transitionTo ( to , toParams , options ) {
209
207
if ( ! isDefined ( options ) ) options = ( options === true || options === false ) ? { location : options } : { } ;
210
- options = extend ( { location : true , inherit : false } ) ;
208
+ options = extend ( { location : true , inherit : false , relative : null } , options ) ;
211
209
212
- to = findState ( to ) ;
210
+ to = findState ( to , options . relative ) ;
213
211
if ( to [ 'abstract' ] ) throw new Error ( "Cannot transition to abstract state '" + to + "'" ) ;
212
+ if ( options . inherit ) toParams = inheritParams ( $stateParams , toParams || { } , $state . $current , to ) ;
214
213
215
214
var toPath = to . path ,
216
215
from = $state . $current , fromParams = $state . params , fromPath = from . path ;
0 commit comments