I am using ion-tabs
and ion-tab
components for Ionic 3
. Currently, when user switches between tabs the component in the tab <ion-tab [root]="SomeComponent"></ion-tab>
is only initialized when the user switches to it first time. After that ,there is no more call of the ionViewDidLoad
or ngOnInit
. The question is: Is it possible to destroy the component on tab change and then initialize it again later?
Use the ionViewWillEnter and ionViewWillEnter lifecycle event on your page.
You can put the correct code in that method to initialize or destroy necessary things on your page
https://ionicframework.com/docs/api/navigation/NavController/