I have a question I just can't seem to figure out in testing and research online.
I have an Ionic Angular App I am developing. I lazy load the pages and popovers, but I noticed lazy load triggers both ngOnInit() and ionViewDidEnter() of my tabs and pages. However, I really didn't want ionViewDidEnter running unless the user actually selected those pages. I also did not want ngOnInit() to run until my app component has finished some async functions like logging in and pulling data from native storage.
So is there a way I can preserve lazy loading but hold off initializations until I am ready in the app component?
I think for the ionViewDidEnter() method I can simply use a boolean value saved in a service so I will only run content in the ionViewDidEnter with a simple "if" statement.
ionViewDidEnter(){
if(this.myService.finshedAppInit){
// Do stuff
}
}
lazyload in app routing module as such
{
path: 'tabs',
loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule)
},
Any thoughts? Is there a particular standard to follow with loading up an app but waiting until particular async methods are complete before anything past the splash screen and app component are loaded?
I tried removing lazy loading, but this made its own issues.