Ionic-framework: nav.setRoot to a page without tabs still display tabs

Created on 21 Oct 2016  路  11Comments  路  Source: ionic-team/ionic-framework

Hey,

I've created following test application:

Tabs
-- Contact, Home, etc.
Testpage (subpage accessed thru menu)
Test2page (another root page)

Behavior excepted:

From the tabs menu, I open sub page "Testpage" and click to set the new root "Test2page" without seeing anymore the tabs at the bottom of my page, since that new root page isn't a tabs page.

Behavior tested:

From the tabs menu, I open sub page "Testpage" and click to set the new root "Test2page" but when that page is successfully loaded I still see the tabs bar at the bottom of my page.

Here a project to reproduce the behavior (just implemented two pages in the start app):

https://github.com/peterpeterparker/ionic2RC1-test

Thx in advance for the fix or to let me knows how I could solve that issue.

Best regards

P.S.: Issue maybe link with another tabs issue https://github.com/driftyco/ionic/issues/8682

Most helpful comment

You are changing the root of the tab, remember that each tab has his own navigation stack. You have to setRoot() to the root navigation controller:

constructor(public app: App) {}

(...)
    this.app.getRootNav().setRoot(Test2Page);

All 11 comments

You are changing the root of the tab, remember that each tab has his own navigation stack. You have to setRoot() to the root navigation controller:

constructor(public app: App) {}

(...)
    this.app.getRootNav().setRoot(Test2Page);

Get it, sweet. Thx a lot @manucorporat

Hi! It didn't work out for me and it didn't show any error
I'm in ionic 2.0.0

i use :
aboutPage is a page of TabsPage :
inside about.ts :
openPage() {
this._nav.goToRoot(OtherPage);
}
you're now out the tabs

thanks a lot @manucorporat

thanks brother... it worked

How is it done now that getRootNav() is deprecated?
I would like to navigate from one page with tabs to a new page with different tabs. It works with getRootNav() but I can't figure out another way to do it with out using getRootNav(). Any help?

@obbe79 Did you find any solution for the same ?

@obbe79 @hardikrawal23 I guess you would still have to use getRootNav() for now on, I least I do

There is an open issue https://github.com/ionic-team/ionic-site/issues/1197 about clearing up what's the id to use, but it is open since a long time without answer

The following worked for me:

// Import
import { App } from 'ionic-angular';

// Init
constructor(private app: App)

// Call
this.app.getRootNavs()[0].setRoot(SignInPage);

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexbainbridge picture alexbainbridge  路  3Comments

RobFerguson picture RobFerguson  路  3Comments

manucorporat picture manucorporat  路  3Comments

Nick-The-Uncharted picture Nick-The-Uncharted  路  3Comments

giammaleoni picture giammaleoni  路  3Comments