Go back to the root page


Hi ,
i’m using NavController and i need to go back to the root page of my navigation.

I have TabsPage -> Page1->Page2.
now in Page2 i need to create a button, that brings me back to the root page (TabsPage) .
but when i type “this.nav.pop()” it’s redirect back to Page1.
Please any suggestions?


Try this:



Nothing happens :disappointed_relieved:


Try this.nav.popToRoot() or this.nav.rootNav.setRoot(Tabs)


nav.popToRoot() works like a charm :slight_smile: thanks !


This line will not work lonely because you actually change the root, but the pages that still in the quoue stack is still there, and avoid you to see your root page changes

so you need to add the line:
tell the nav to drop all the views pushed to the quoue all the way to the root.

so in shortly:



Thanks you so muchhhhhhhhh!
You save my life.:smile:


I tried this exact code in my home.ts and it works, but the tab icons are still on the bottom of the screen when it goes to login page.

logout() {

Any idea how to change that behavior? Note that in my app.component.ts, I’m setting the root page on launch.

constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen,
            oauthService: OAuthService) {
  if (oauthService.hasValidIdToken()) {
    this.rootPage = TabsPage;
  } else {
    this.rootPage = LoginPage;
  platform.ready().then(() => {
    // Okay, so the platform is ready and our plugins are available.
    // Here you can do any higher level native things you might need.


I prefer designing things so that the state of authentication is exposed as a ReplaySubject with a depth of 1. That way logout() does not have to ever interact with the navigation system at all. It just calls next(false) on the authentication state subject and lets the code you already have in the app component handle everything:

authService.notifier.subscribe((authed) => {
  if (authed) {
    this.rootPage = TabsPage;
  } else {
    this.rootPage = LoginPage;


Works thanks …


Facing same problem !
Have you solved this???


Yes, I was able to solve it using the following code:

constructor(public app: App, public oauthService: OAuthService) {

logout() {


Can you please provide the answer for this…I have raised the same question in this How to skip TabsComponent Page, when user clicks Back button(<) in Other page.




wooo work for me this.nav.popToRoot()