angularjs - ui-router does not run a parent state's resolve promise when using $state.go() -
i have abstract parent state resolve promise returns information current user. information injected controllers of child states.
however when use $state.go('parent.child')
resolve promise function not being executed. if browse url representing state though, executes fine.
do need specify resolve object on each child state , omit parent?
a parent state resolve resolve once given set of $stateparams
values. if parent state not rely on $stateparams
or not use any, dependencies resolved once, regardless of child state changes.
the difference in behaviour seeing child state change not result in parent resources being reloaded, whereas location change full parent , child states reloaded.
you can observe behaviour in plunk.
the example has $stateparams
value in parent state on children dependent. changing state via $state.go
or ui-sref
(both methods provided) result in refresh of parent resource. however, changing state child state without change $stateparams
parameter not refresh parent resource , returned value provided.
Comments
Post a Comment