Navigate back multiple pages

Is there a way to navigate back multiple pages in ionic3 like $ionicHistory.back(numberOfPages) in ionic v1?

Any help? pop() only go back one page. push() does not clear navigation stack. What should I do?

You can use remove() to remove pages, then pop back to the last page that wasn’t removed.

I made a plunker http://plnkr.co/edit/5ciTDxxBOF50F737kKS5?p=preview.
It seems that remove only works if remove count is 1. Is this a bug?

I don’t understand your code. Say you want to go back 5 pages. How about:

  1. Get index of current view in the current navcontroller.
  2. Subtract 5.
  3. From that point in the nav stack, remove 3 pages.
  4. Pop from your current view to the target page.

Are you saying there’s a bug in that strategy?

I misunderstood the parameter of remove method. I have updated the plunker to fix that.

I had Face the same issue from navigate back between multiple pages so my hierarchy is
homepage->2 page->3 page->4 page, i would like to go back from 4th page to second page i had write

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

and it works for me.

2 Likes

it work for me. thank so much