Reputation: 3124
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?
Upvotes: 0
Views: 1880
Reputation: 698
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/
Upvotes: 2