How to keep tab when pushing a new page?

廉价感情. 提交于 2019-11-26 22:11:55

问题


When I push a new tab like this in my controller:

this.nav.push(EditPage);

the tab disappears. How can I keep the tab?

Pic below:

When the new page comes:


回答1:


You'd need to add the tabSubPages:false config in your ionicBootstrap like this:

ionicBootstrap(MyApp, [], {      
    tabSubPages:false
});

By doing that, and because that each tab has its own history stack, and NavController instances injected into children @Components of each tab will be unique to each tab, the new page will be opened inside the current tab.


UPDATE:

Please notice that with the new release of Ionic 2.0.0-beta.11 (2016-08-05) that config was renamed to tabsHideOnSubPages so it should be:

ionicBootstrap(MyApp, [], {      
    tabsHideOnSubPages:false
});

The previous names have been deprecated. They will still work in the current release but will be removed in the future so please update to the new names.



来源:https://stackoverflow.com/questions/38806047/how-to-keep-tab-when-pushing-a-new-page

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