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

promises in deepStateRedirect.fn #305

Closed EvgeniiVoskoboinik closed 8 years ago

EvgeniiVoskoboinik commented 8 years ago

I'm new in Angular, maybe I don't understand something, but when I try to use this code it doesn't work. `

  deepStateRedirect:{  
     fn: function($q , $timeout){
         var deferred = $q.defer();
         $timeout(function(){
             deferred.resolve({state: 'some_state'});
          }, 200);
     deferred.promise.then(function(s){return s;})
    }
 }

` And when i dont use promise all work well

christopherthielen commented 8 years ago

Deep state redirect is synchronous, so you can't use promises.

UI-Router 1.0 hooks support asynchronous processing. See https://ui-router.github.io/docs/latest/interfaces/ng1.ng1statedeclaration.html#redirectto