Ion-tabs just for one page?


#1

is it possible to add an ion-tabs just for a page ?

I have PAGE: Restaurants and PAGE Favorites

how can i add a tabs to switch between Restaurants and Favorites without this tab appears on other pages ?

I searched and only found how to hide it.But i want to add to particular page because i will have another tabs for another pages.

Thanks !


#2

-> is it possible to add an ion-tabs just for a page?

Try:

<ion-tabs [selectedIndex]="tabIndex" name="event">

  <ion-tab [root]="tab1Root" tabTitle="Restaurants" tabIcon="restaurants"></ion-tab>

</ion-tabs>

#3

Hi,thanks for the help again.
for unknown reason,when i add it to my page,when i click to load it,the browser stop responding and i need to force to close it.

i added :

<ion-tabs>
  <ion-tab [root]="tab1Root"></ion-tab>
  <ion-tab [root]="tab2Root"></ion-tab>
  <ion-tab [root]="tab3Root"></ion-tab>
</ion-tabs>

and

 tab1Root = Page1;
  tab2Root = Page2;
  tab3Root = Page3;

#4

I don’t know ig i get your question right.

I have an app with tabs as root page. When I use navCtrl.push(‘newPage’) then it shows the new Page without tabs.

Or I use this to push another tab page with different tabs.

And I use nabCtr.setRoot(‘loginPage’). Works too.


#5

Hello Jacktoolsnet ! thanks ! i’ll try it but if i use it,when the user changes the page via push,the tab will not change indicating which page he is alright ?


#6

No. The pushed page lays over the tab page until you use navCtrl.pop() to remove it.


#7

but using like this,i can’t use this plugin alright ?


#8

I think you have to try it. But why not?


#9

i don’t think so,because the supertabs use this stucture:

<ion-tabs>
  <ion-tab [root]="tab1Root"></ion-tab>
  <ion-tab [root]="tab2Root"></ion-tab>
  <ion-tab [root]="tab3Root"></ion-tab>
</ion-tabs>

if i push one page,i’ll not be using that stucture above,do you agree ?


#10

This looks like in the ionic docs.

Here is a screencast where you can see how setroot an push works.


#11

Wow awesome app!

i just solved my problem.
I was generating a new page,but instead of use ionic g page,i used ionic g.
ionic show me list and i found “tabs” in the list,so i create the tabs via cmd,tested and is working well !

i added too :

tabsHideOnSubPages="true"