TLDR: How do you implement two pages each with with one <ion-tabs> (each containing at least two <ion-tab>s)? The tab names and icons change, the tabs content changes only after clicking on it.
I have a problem for which I struggled to find a solution for. I saw other people post about this too, also to no success. I hope that here someone knows the solution
I want to write an app in Ionic 3 in which I have two pages with <ion-tabs> each containing 4 <ion-tab>s. I wrote two pages called home and hometwo (referred to as basepages). In each html I declared the ion-tabs.
Then I made 4 pages (about, abouttwo, contacts, contactstwo; referred to as tabpages), two of each are in the <ion-tab>s of the each homepage.
Next I made a button on the first homepage that pushes the second home page on to the navCtrl. (I didnāt put the button on one of the tab pages, because then the page wouldāve gotten pushed onto that nav, since each tab page seems to have itās own nav https://ionicframework.com/docs/api/components/tabs/Tab/).
Expected behaviour:
The second basepage gets pushed onto the stack and displays the new tabs along with their respective names icons and content.
Observed behaviour:
The second basepage gets pushed onto the stack and displays the new tabs along with their respective names and icons. BUT the content of the pages is the one of the respective tabs of the first basepage. Only after clicking each new tab will the content change.
Does anyone know how to fix this?
(One of my less than good solution ideas, which I couldnāt figure out how to do, involved āghost-clickingā all the tabs once as soon as the page loadsā¦ So yeah )
Hi @judgewest2000. Thank you for your answer! Yeah the approach using segments is my emergency solution, but It would be awesome to get it working using actual tabs (amongst other things, because of icons + words = better UX)
Sans brackets.
No idea if this could help with your overall problem but Iāve used that property before and believe I wrote it out in that form with success
Iāll just accept yours as the answer My team used the segments approach now tho. But I guess future people can look at your code and use that GG thank you for your help
Your solution works visually right, but navigation stack is messed up.
You add push pages as subpages of the root tabs components. Hiding tabs bar makes illusion of navigating to totally separate page. But in markup we see outer tabs with inner tabs bar. @Hesters, if it was what you were looking for, thatās good.
Maybe you have any solution with correct navigation?