In my Angular application, I have the following architecture:
Index Page -> Shell Page -> User view (User can open subview from here)
Every route change in my application goes through the Shell page. There is a function on the Shell page called activate which should only be invoked the very first time the application is loaded.
// The activate function displays a toaster message when the application is loaded
function activate() {
logger.success(config.appTitle + ' has been loaded!', null);
}
As the routing changes go through the Shell page, the activate method is mistakenly invoked even when transitioning between views. I want the activate method to only run the first time the application loads, not during route changes.
How can I make this work as intended? Thank you.