Ionic, Ion-nav , how start from last component and go backwards step by step

186 Views Asked by At

I have steps, for that using ion-nav/ion-nav-link, problem is sometimes I want to start from the last step(components) and go back step by step. How can I implement that? For regular situation is fine when I start from first step and go forwards, can go back … but do not know how can I start from end and and go back(or forwards after go back). Thanks

1

There are 1 best solutions below

0
On

Each time you use ionic nav to go to another page/component, it places a new view on top of the stack (think of like a deck of cards). On the page/component that shows, you can place a back button that navigates back to the previous component and it removes that page/component from the navigation stack:

1 page > 2 page > 3 page (back button pressed) > 2 page

So from what you are trying to do, you cannot. But you can just start from the last page/component like you said and just go backwards from there using ionic nav without using a back button on either of the pages:

3 page > 2 page > 1 Page

or you can use slides, and place components in there. they move back and forth with ease: https://ionicframework.com/docs/api/slides

more info can be found in thier docs: https://ionicframework.com/docs/angular/navigation