3

When I call this.navCtrl.popAll();, I get this error:

Error: Uncaught (in promise): navigation stack needs at least one root page

But the root page is set in app.component.ts:

rootPage = LandingPage;

What is still missing?

Display Name
  • 4,502
  • 2
  • 47
  • 63

1 Answers1

10

I have the same issue

Error: Uncaught (in promise): navigation stack needs at least one root page

... when I use registerbackbutton for hardware back button in Android. And then I try to call this.navCtrl.pop() for back to previous page.

My solution:

In app.component.ts

import { App } from 'ionic-angular/components/app/app';

/* define in constructor */
constructor(public platform: Platform, app: App){
    this.platform.ready().then(() => {
        this.platform.registerBackButtonAction(() => {
            app.navPop();
        });
    })       
}
Błażej Michalik
  • 4,474
  • 40
  • 55
Abi Meii
  • 116
  • 2
  • 3