Ionic 2 - How do I get back to the homepage of a particular tab

Asked

Viewed 1,022 times

0

My APP works with tabs, within those tabs I have buttons that open other pages using the push, when I click on tab 2, and I click on a button, it opens the normal page, then I click on tab 1, and then click again on tab 2, only instead of showing the home page of tab 2, it already comes open with the page I had clicked before.

How do I so that every time he clicks on a tab, he shows exactly the home page of that tab, and not bring open the page I had visited? I tried to use the this.tabRef.select(0); within the tab.ts, but it clicks twice on the first click of each tab, which causes a blink on the screen leaving it blank for a few seconds by calling twice the same..

I tried the this.navCtrl.setRoot(HomePage);, but he takes the tabs from the screen, as it assumes Homepage as home page.

RESOLVED Just put that on the inside pages ionViewDidLeave(){ this.navController.setRoot(/*sua pagina inicia da tab*/); }

  • Can you post your code snippet? It’s easier for the community to help you.

  • This is something gives own tab of Ionic 2... just wanted to know a way it does not leave open and take the stack the previous page, or when clicking the tab, it always bring the page set in the root of TabsPage... tried to use the pop within the ionViewWillLeave(), but then he shows up a Warning You can’t remove all the pages in the navigation stack. Nav.pop() is probably called Too Many times

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.