I’m sure there are questions out there around this but I couldn’t think how to phrase the question. I have a simple/common problem. If I have valid session info in the local storage I need to make a few requests as the app loads, but before any navigation happens because routing could be affected. This needs to happen after the app is loaded so I can use some of the services, but before any UI stuff actually takes place. Can someone point me to a resource? I am using Angular 5 and uiRouter.
See: Router Guards:
Router Guards return either true if the user can access a route or false if they can not access .So your guard can also tell the router to navigate elsewhere and cancel the current navigation.
In your case use Guard to check if app have valid session info in the local storage and navigate as required then you can also use Resolve in your app to make a requests as required.
Answered By – Mukesh M
Answer Checked By – Mary Flores (AngularFixing Volunteer)