Problems with Tabs Navigation,


#1

I’m creating an app with ionic and angular, and I’m making use of tabs. I have 5 tabs, and one of them displays a “Menu” page, this page contains the listing of other pages that are not on the tabs, each item in that listing redirects to a different page.

My problem is that when I click on the Menu tab, it displays the listing and I select the page I want to go to, but if I click on another tab, and then click on the Menu tab again, it will no longer list the items, and will instead display the last page I had accessed through the Menu.

To get clearer :::

I click on the Menu tab
I see the list of items
I select the Customers item
I am redirected to the Customers page
When I click on another tab (example: Products), I am redirected to Product pages
When I click on the Menu tab again, it does not display the page with the items, but rather the Customers page, which I had previously accessed.

I don’t think there is an error in my code, but I would like to know if there is any ionic function that I can use to do this clean after I leave the page, I tried the ionViewDidLeave, but it did not work.


#2

Each tab is basically a NavController so each tab has its own navigation stack (of pages). So your App is functioning as expected when you use Tabs and Tab.

See:

Have you tried:

ionViewDidLeave() {
  this.navCtrl.popToRoot();
}

See: https://ionicframework.com/docs/api/navigation/NavController/#popToRoot