here i have sample project in which i am testing the ionic lifecycle in that i observed that i unable to call the ionic lifecycle hooks
ionViewWillLeave(),ionViewDidLeave(),ngOnDestroy()
below is my file structure
From tab1 page i am calling info page while calling i am unable to capture these events and after going to that page and when going back i unable to call ionic view enter, did enter hooks
In tab1.page.ts
ionViewWillLeave(){
console.log('ion will leave');
}
ionViewDidLeave(){
console.log('ion did leave');
}
ngOnDestroy(){
console.log('seesion destroyed');
}
goToNav(){
this.router.navigate(['/','info']);
}
In app-routing.module.ts
const routes: Routes = [
{
path: '',
loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule)
},
{
path: 'info',
loadChildren: () => import('./user/info/info.module').then( m => m.InfoPageModule)
}
];
note : after navigating to other page and when u i am navigating back to the tab page i unable to call any life cycle events