getRootNav() deprecated, use getRootNavById(): what's the value of the root nav id?

Oh actually that’s a post a originally created :wink:

So well then here the current status and why I gonna mark this thread as solved:

Go on with getRootNav() if you use Ionic v3

In any case, as far as I understand, the all routing will be different with v4

console.log("page id is: " + this.nav.getActive().id);

Read about your approach on another thread & tried to implement it to pop back to the loginPage from a presented Modal “Settings” page where the “logout” button user profile is

… Seemed like a good idea, but it had no effect.

Set up ReplaySubject in my userAuthSvc to send true/false if authorized. Subscribed to it in app.component, and it worked to see true/false for “authed” or not after logging in/out …

… But setting the Root Page for the app to either “LoginPage” or “TabsPage” in app.component accordingly had no effect. Was there a step missing? Is that alone supposed to trigger navigation? Not sure what the default behavior should be, but it didn’t do anything.

What did work was importing the App into the modal Settings page, getting the App’s root and popping to that. Messy, but it works.

Now I’m seeing the same deprecation warning that OP asked about over a year ago, with no solution. Good design or not, it’s kind of ridiculous that after over a year there’s no answer to such a straightforward question.

Apparently Ionic4 will completely change how navigation & routing works anyway so maybe it doesn’t matter?

1 Like

Exactly I think at the end now it doesn’t matter. With v3 I’ve the feeling that you should just ignore the warning. With v4 the routing has change

Since I opened this post on the forum I gonna close it and mark this as the solution even if there isn’t one and one solution to my original question

1 Like

This doesn’t work when the user enters the path to a specific page. The specific page is set before the rootPage in the app.component and then it gets overwritten.

i have used this to remove the warning

this.appCtrl.getRootNavs()[0].push(PageToBePushed)

and it doesn’t matter to Ionic 4 because it changes the routing strategy