How to rest/refresh/destroy pages on tab


#1

Hello,

I’m using side menu and super tabs which include 3 pages, when click details button on home page it will go to the super tabs, now each page on super tabs has own API, there is set timer will fetch data every 30 second, Problem is when go back root home, the pages on the tab still connect to the API which mean function still working, i want to clear or destroy pages for each pageson the tab when press home page or when press another page on the tab?!

My code on super tabs:

tabs.ts:

ionViewDidLeave() {
console.log(‘ionViewDidLeave TabsPage’);
this.navCtrl.popToRoot();
}

onTabSelect(ev: any) {
console.log(‘Tab selected’, 'Index: ’ + ev.index, 'Unique ID: ’ + ev.id);
}

on tabs.html

<super-tabs electedTabIndex=“2” toolbarColor=“light” toolbarBackground=“dark” indicatorColor=“light” badgeColor=“light” [config]="{ sideMenu: ‘left’ }" (tabSelect)=“onTabSelect($event)”>
<super-tab [root]=“exchangePage” title=“1” icon=“home” [rootParams]=“navParams.data”>
<super-tab [root]=“exchangePage” icon=“ios-analytics” title=“2” [rootParams]=“navParams.data”>
<super-tab [root]=“testPage” icon=“md-analytics” title=“3” [rootParams]=“navParams.data”>

Thank you.


#2

I tried to use ionViewDidLeave, but still function is working even on the home page

PageTab1.ts

ionViewDidLeave() {
console.log(‘ionViewWillLeave TabsPage’);
clearInterval(this.interval);
}