christopherthielen / ui-router-extras

THIS PROJECT IS NO LONGER MAINTAINED -- Extras for UI-Router for AngularJS. Sticky States (a.k.a. parallel states), Deep State Redirect (for tab-like navigation), Future States (async state definition)
http://christopherthielen.github.io/ui-router-extras/
MIT License
917 stars 211 forks source link

$state.go not does not return the promise (FutureState) #350

Closed nahuelramos closed 7 years ago

nahuelramos commented 7 years ago
$futureStateProvider.futureState(newFutureState);
 $state.go(newFutureState.name).then(function(data){
Never enter by then
}).catch(function(data){
Error here (Image of console.log)
});

image error

But The transition occurs satisfactorily.

christopherthielen commented 7 years ago

Agreed, this would be really nice. Unfortunately it's not possible in the Future States architecture. The future state code listens for the $stateNotFound event, which is emitted when you go to newFutureState.name which doesn't exist. That promise must always be rejected for the not found event to fire. A new $state.go() is run after the future state is loaded.

In ui-router 1.0 (which has future states baked in), this works as you expect. The promise returned from $state.go() resolves after the future state is loaded and transitioned to.