What’s the best way to pop back X pages ? We have landed on repeatedly calling pop with animate set to false. This works but it seems inelegant. If there’s a better way let me know. I tried the remove method but I couldn’t actually see that it did anything. While we’re discussing it, I am also curious if anyone has pages in their application representing a particular flow, that they call from multiple places in the app. Obviously you want the flow to complete and then return the user to the page they started. We haven’t found a great way to achieve this when the page we want them to go back to isn’t a root already.
this.navCtrl.pop().then(()=>{
this.navCtrl.parent.navCtrl.pop()
});
I am just doing a wild guess just check if it works.
Hi @shipps.
This work for me on ionic3 v3.3.0
this.navCtrl.push(
PresentationPreviewPage,
{
id : this.presentation._id
}
).then(() => {
const startIndex = this.navCtrl.getActive().index - 2;
this.navCtrl.remove(startIndex, 2);
});
In Ionic 3 v3.5.0 this solution does not work and I’m looking for a better solution.
Wow, I found it!
const startIndex = this.navCtrl.getActive().index - 1;
this.navCtrl.remove(startIndex, 2).then(() => {
this.navCtrl.push(
PresentationPreviewPage,
{
id : cloned_id
}
);
});
this.nav.pop().then(() => this.nav.pop());
1 Like
this.nav.pop().then(() => this.nav.pop());
this is work for me thanks…
1 Like
How to do with ionic 4? This works
this.nav.pop().then(() => this.nav.pop());
But I don’t want to see transactions of pages.
Go directly to the last pop().
this.navCtrl.remove(this.navCtrl.getActive().index - 1, 2);
This worked for me. Removes the last two pages.
this works for me too