Back button on list view when page reload or direct URL



I’m learning ionic, so far so good. Very impressive work!

I have a question about back button. On list view example, when you go from list to detail view, you have a back button on the top bar. But if you reload the page like this one for example, there is no more back button, but I’d like to have it to move back to the list.
Is there an easy way to do that?

Thanks a lot !!


Other than for development, why is it a problem that the back button is no longer there after reload? When being ran as an application on a mobile device, I don’t envision a use case where this would happen. While you are developing, you can just press the back button in the browser after refreshing and it will take you back to the previous page.


@sgruhier, this is as @samsinite says. It’s difficult to know where in the app you are if you haven’t navigated there yet. So we make the assumption you’ll be viewing this in a native app where the user will always start from the first page (or the session will be retained and the history stack with it).

Maybe there is something we could do here to make it a little better though, I’m open to ideas!


@max, you’re right for native app, as you said, it doesn’t make sense since you always start from first page. But I’m working on a mobile web application, not an native app. If someone shares the show URL like on twitter for example, it makes sense to me to see the back arrow to be able to go back to the list.

Back button should lead to #/ (in the pet example) and slide content from the left.
It means the “Page1Ctrl” controller should be unshifted in NavController stack, and the view slided from left to right.
I don’t know if it’s easy to do.

Do you only want to support native app or also web application?

Thanks for you quick answer, too bad I didn’t get notifications.


@sgruhier I don’t believe the Ionic devs can do anything about this. AngularJS itself manages the history stack. When you reload the page, Angular is getting initialized from scratch. So, it has no way of knowing what the user did beforehand. Essentially, on reload these never was a history.


Yep, this would be better processed in your custom app code which would then mess with the history state. We are overhauling the nav stuff this week and next so perhaps with ui-router it would be easier to tweak.