Iām not a javascript/angular expert, but could that be a āmethod pointerā problem, does it work when you donāt call a method but access the nav directly in your function?
initializeApp() {
this.platform.ready().then(() => {
StatusBar.styleDefault();
this.dbs.init({});
// Like this
this.platform.registerBackButtonAction(() => {
this.nav.setRoot(Main);
});
);
nav is of type NavController. The more complete code would be:
constructor(private platform: Platform, private nav: NavController) {
this.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.
StatusBar.styleDefault();
Splashscreen.hide();
this.platform.registerBackButtonAction(() => {
this.nav.setRoot(YourPage);
});
});
}
which is found in the main appComponent: āapp.component.tsā.
constructor(
public platform: Platform, //Platform controller
public app: App, //App controller
) {
platform.ready().then(() => {
StatusBar.styleDefault();
Splashscreen.hide();
//Registration of push in Android and Windows Phone
platform.registerBackButtonAction(() => {
let nav = this.app.getActiveNav();
if (nav.canGoBack()){ //Can we go back?
nav.pop();
}else{
this.platform.exitApp(); //Exit from app
}
});
});
}
Obviously, parameter priority was not working (affects nothing) in Ionic 2.0.0-rc.4ā¦ Is this param working as expected in the latest version of Ionic? Letās say Ionic 2.0.0 (2017-01-25)ā¦?