Closed adamreisnz closed 4 years ago
you can access the resolves from an exiting state by getting the injector for the "from" path path:
.onExit({ exiting: 'foo.bar' }, trans => {
// Gets the resolve value of `myResolve` from the state being exited
var fooData = trans.injector(null, 'from').get('myResolve');
});
See: https://ui-router.github.io/ng1/docs/latest/classes/transition.transition-1.html#injector
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
This does not mean that the issue is invalid. Valid issues may be reopened.
Thank you for your contributions.
This is a (check one box):
My version of UI-Router is:
"@uirouter/angularjs": "^1.0.20", "@uirouter/core": "^5.0.21",
Bug Report
I'm getting a
Resolvable async .get() not complete
error when trying to obtain a resolved value in anonExit
hook. This strikes me as odd, as the route has already been resolved, and the resolvables are all there. So why are they not available in anonExit
hook?E.g:
Expected Behavior:
To have all the resolvables of the state available in the
onExit
hook.Link to Plunker or stackblitz that reproduces the issue:
http://plnkr.co/edit/KOClmTCu8ajm5BYP93uM
From playing around with it in Plunkr, it appears that the
onExit
hook is actually trying to get resolvables for the new state. How can I get the resolvables for the state I'm exiting?I need access to them to do some cleanup.