When navigating from one page to another, Ionic automatically display back button at the navigation bar. However, there are certain case where ionic don’t display the back button. For example, when you navigate from a tab page to a none tab page.
How can I force Ionic to display back button on certain page?
Javascript:
.state('app.tab.playlists', { //<!-- Tab content page
url: '/playlists',
views: {
'tab-Content': {
templateUrl: 'templates/playlists.html',
controller: 'PlaylistsCtrl'
}
}
})
.state('app.singer', { //<!-- Not tab content page (if you navigate from tab page to this page, back button will not displayed)
url: '/singer',
views: {
'menuContent': {
templateUrl: 'templates/singer.html'
}
}
})
Ionic back button is based on the states -> you can go back from a child to a parent.
I think what You want here is a history back button, like in web browsers, right? Where it doesn’t matter where You came from You just want to go back to wherever You were.
If that is the case I’m afraid there is no such functionality in Ionic right now.
@menelik Thanks a lot for your answer & help. But how can I get the original back button display from ionic? I mean like the original back button that will automatically has different style & display on both iOS and Android.
<ion-nav-back-button class="button-clear"
ng-click="myGoBack()">
<i class="ion-arrow-left-c"></i> Back
</ion-nav-back-button>
Unfortunately this approach didn’t work for me. The button will not show up. I guess it’s because there is no parent-child history as you’re navigating to a new state outside your tabs.
Maybe some ionic pro’s in forum know another way to do it while keeping the ionic ion-nav-back-button.
It seams user jdupouy found a working solutions while keeping the original ion-nav-back-button. I will try to use this approach for my own app as well.