How to go back multiple pages in ionic 3

ぃ、小莉子 提交于 2019-12-11 19:53:17

问题


I have the page flow like below:

A->B->C->D

Somehow I will do a function in page"D", after it need to go back page"B". How can I achieve that? Using .pop() just can go back one page. Using .push(B) is also not the solution, because the flow will become:

A->B->C->D->B

The solution I want is:

A->B

Anyone know how to achieve it? Thanks a lot.


回答1:


this.navCtrl.popTo(this.navCtrl.getByIndex(this.navCtrl.length()-(N+1)));

Where N is the number of pages that you want to go back.

So if you want to go back 2 pages N=2




回答2:


Try Using the popTo() method by giving the index of page in a parameter like below:

nav.popTo( this.navCtrl.getByIndex(1))


来源:https://stackoverflow.com/questions/48336846/how-to-go-back-multiple-pages-in-ionic-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!