Hide tabs in sub pages in Ionic 2 [duplicate]

心已入冬 提交于 2019-12-01 06:41:14

You can also try by setting the tabsHideOnSubPages config property in the app.module.ts file like this:

... 
imports: [
    IonicModule.forRoot(MyApp, {
        // Tabs config
        tabsHideOnSubPages: true,
        ...
    })
]
...

From Ionic docs:

tabsHideOnSubPages: boolean

Whether to hide the tabs on child pages or not. If true it will not show the tabs on child pages.

To add "tabsHideOnSubPages: true" in app.module.ts works for me. (ionic 2)

To be completely flexible with when to hide and show the tabs, you can also just use a CSS class like the following:

ion-tabs.hidden div.tabbar {
    display: none
}

In your tabs.ts you can have a boolean variable to denote if the tabs should be hidden.

public hideTabs:boolean = false;

In tabs.html add ngClass to ion-tabs to apply the hideTabs style when the variable is true:

<ion-tabs [ngClass]="{'hidden': hideTabs}">

You can toggle the hideTabs variable in any function f.e. inside the function that navigates to a subpage, but also in ionic's ionViewWillEnter() functions.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!