Ionic Tabs Clear history after naivgation


#1

I am navigating between tabs using the following

this.navCtrl.parent.select(0);

After navigation I do not want the hardware back button to take me back.

Is there a way to clear history after navigating between tabs??


#2

Hi @almighty99 - did you ever find a solution to this?


On tab change clear previous tab nav history
Reset a tab after going to different tab
#3

Quick update. I found a solution. I used the ionChange event:
<ion-tabs (ionChange)="tabChanged($event)">

When this fires, the event provides the tab being navigated to. In my case I only wanted to ditch history on one of my tabs. Adding below worked well:

tabChanged($ev){
  if($ev.tabTitle === "TITLE_HERE"){
    $ev.setRoot(PAGE_HERE);
  }
}

#4

I handled the hardware back button using something similar

  platform.registerBackButtonAction(()=>{
})