Angular 1.6.1 and ui-router 1.0.0rc;
I am having a problem with ui-router when redirecting from one state to another.
A is TransitionRejectionregistered because it is replaced.
Transition #1 r0: Started -> "Transition#1( 'intro'{} -> 'foo'{} )"
Transition #1 r0: <- Rejected "Transition#1( 'intro'{} -> 'foo'{} )", reason: TransitionRejection(type: 2, message: The transition has been superseded by a different transition, detail: 'bar'{"id":"uuid-1234-uuid"})
Transition #2 r0: Ignored <> "Transition#2( 'intro'{} -> 'intro'{} )"
Transition #3 r0: Started -> "Transition#3( 'intro'{} -> 'bar'{"id":"uuid-1234-uuid"} )"
Transition #3 r0: <- Success "Transition#3( 'intro'{} -> 'bar'{"id":"uuid-1234-uuid"} )", final state: bar
Note: globally there is a trick, it is used for automatic control when the user does not decide when loading the state:
.config($urlRouterProvider => {
$urlRouterProvider.otherwise('/');
})
.run(($transitions, $trace) => {
$trace.enable('TRANSITION');
$transitions.onError({}, trans => trans.router.stateService.go('intro'));
}
Transition Fragment
.component('bar', {
template: someTemplate,
controller: someCtrl
})
.config($stateProvider => {
let states = [
{
name: 'foo',
url: '/foo',
redirectTo: { state: 'bar', params: { id: 'uuid-1234-uuid' } }
},
{
name: 'bar',
url: '/bar/:id',
component: 'bar'
}
];
states.forEach(s => $stateProvider.state(s));
})
While in this example intro -> fooit ends up in the correct state bar, other transitions (if not from intro(default)to bar, but from baz, qux, ..to bar) end up in an infinite transitional cycle.
, qux foo, bar, qux -> intro: ( qux -> foo, )
TransitionRejection(type: 2, message: The transition has been superseded by a different transition, detail: Transition
- , catch-all? , -, .