Take user global object as example. For a single page web app without refreshing the browser, the first entry could be populating the user object in the service.
But say, the URL is still being used as links to go to different route of the app. At what point, every component which using the user object in the route should be loading the user object from server? Since service is loading user
asynchronously, how could these components in the current route can surely get the user before this user object is available?
I might be asking the wrong question because I want to solve this issue. So my thought is that if I can load the service object first before all other components, then it's solved.
I thought if I put service in app.component.ts, but it doesn't matter. Other components still being instantiated while user still undefined
.