how to pop all pages except Root in ionic 4 ?
try this!
this.navCtrl.popToRoot()
not exist popToRoot() in NavController in ionic 4 beta 17
Hnm, weird, in this Docs have a popToRoot, sorry for that!
Please refer to the error message in console :
Property ‘popToRoot’ does not exist on type ‘NavController’
hello,
maybe there is something different wrong, because documentations says it exists.
Best regards, anna-liebt
Can you post your code? Probably your import have a error…
sorry for my late reply,
component class code in following :
import { NavController } from '@ionic/angular';
...
constructor(private navCtrl: NavController){
...
private goToHome(){
this.navCtrl.popToRoot().then(() => {
....
});
}
use <ion-router-outlet main></ion-router-outlet> in app.component.html
not any solution for this problem ?
hello,
yes and sorry NavController has no popToRoot in v4.
Maybe you can implement ion-nav which doc says that it has popToRoot.
Best regards,
anna-liebt
Can someone publish a solution for this?
you can import router from @angular/router and then use a method called navigateByUrl like this
this.router.navigateByUrl('/home');