Non linear navigation

Hi all,
In my old app I have a list of items.
When you click on an item you get it’s details page.
When you swipe left or right on the details page the app used to insert a new page in the NavController and push/pop to it so swiping takes you to the next or previous details page and the back button still works as expected.

e.g. List shows 1, 2, 3
Click 2 to get the 2 details page
swipe either direction but lets say left/forward:
The app inserts details page 3 before the current page then pops
(now you see details 3 but the back button takes you up to the list)

Is there a way to do this with the new routing system ?

I don’t think is a good ideia to use swipe gestures to navigate between pages.
Think about user experience, people are used to click a button o something and go to other page, click the back button e go to the previous one.

Swiper would be the perfect solution for your case. Why don’t you give it a try?
You would still be able to ‘navigate’ between components by swiping left/right and as a bonus wouldn’t need to deal with routes

1 Like

Whether swiping or buttons I have the same issue: I want to insert a new page onto the stack (in ionic 3 terms) and move to it.
I’ll have a look at swiper.

Edit: looks like ion-nav might be what I need…

ion-nav got beyond my level of comfort very quickly. Pretty sure it would have worked if I stuck with it, but I’m impatient.

I found 2 ways to do what I wanted - one is a hack, the other is “right” (for me)

The Hack:
In my service that shares data between pages I added a new piece of data used by the “list” page to say what page to go to next.
User hits the “next item” button.
Detail page figures out the next item and stores it’s ID in the service then calls Location.back()
The list page has an ionViewWillEnter() that checks if the ID is set and if so navigates directly to the required detail page.

This works 100% - you do see the list page flash up for a second (at least in the browser). Navigation works, back button works as expected.

The right way (in my case):
In my case all the detail pages are the same so I don’t actually need ANY navigation - I just need to change the data the page is rendering and ionic’s data binding takes care of the rest.
There was a little be of refactoring because some values were calculated once at page creation - these had to be redone on “data change” but it all works perfectly now.