I'm converting from AngularJS to Angular6 currently but am not finding any solutions to this question.
Where is it best practice to keep app logic that needs to run on every page that the angular app loads on?
Example logic is logging a user in based on a cookie stored on the machine. Where should I put this logic to check for the cookie and log the user in?
The best place I've seen thus far is in app.component.ts
. I used to accomplish this in AngularJS via loading a GlobalController
on all pages and then loading a HomepageController
etc that would load for the specific "partial" that was plugged into the page.
e/ To clarify, this was just an example and isn't the ONLY business logic I need to run on every page. I need to trigger backend requests every ~10 seconds that check timers on the server (for app timeouts/etc).