We are faced with the challenge of supporting a legacy module that requires synchronous code to run after templates have been fetched and attached to the DOM.
As we transition from our custom router to UI-Router, we have successfully resolved the route and fetched the templates. However, we are struggling to find a way to hook into the process after the templates are loaded.
Project Details:
- UI-Router: 1.0.0-rc.1
- Angular: 1.5.8
We have experimented with the onSuccess
hook, where we return a resolved promise
and chain it with a then
callback. Unfortunately, this approach is still within the transition lifecycle and the templates have not yet been attached to the DOM. The same issue persists when utilizing resolve blocks in the state definition.
Although using a timeout after onSuccess
does work, it is not the ideal solution.
While we do have redux-ui-router at our disposal, dispatching a thunk when onSuccess
is triggered would require additional refactoring for the older module.
If you have any insights or suggestions on how to address this issue, we would greatly appreciate it.
Thank you!