angularjs - Angular UI-Router state resolve depending on another resolve -


edit: works, problem coming else.

i struggling edge-case scenario, basically:

$stateprovider.state('mystate', {   resolve:{     resolvea:  function($q){       return $q.when('whatever');     },     resolveb:  function(resolvea){       return fetchsomethingbasedon(resolvea);     }   } ); 

this not work resolvea can't injected in resolveb function.

there few options considered rejected:

  1. make resolvea returned value object {resolvea, resolveb}. discarded because have many side effects on existing controllers.
  2. handle resolveb behaviour @ controller level. discarded because state abstract high level one, don't wan't change children states/controllers

ui-router nested resolve doesn't work on same state, should work on nested states. can access resolved objects parent state.

$stateprovider .state('parent', {   resolve:{     resolvea:  function($q){       return $q.when('whatever');     }   } ) .state('parent.child', {   resolve:{     resolveb:  function(resolvea){       return fetchsomethingbasedon(resolvea);     }   } ); 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -