The sidemenu template has several nested states defined in app.js. When you navigate to a nested state (e.g., ‘app.single’) the ion-nav-bar is updated with a ‘< Back’ button.
When you return to the ‘home page’ (’/app/playlists’) the back button is replaced with a ion-navicon (see menu.html). You can also transition to the home page by adding a simple function to a controller:
And invoke the goHome() function from the views controller you do transition to the home page, however, the back button is NOT replaced with the ion-navicon?
This is also the case if you navigate from one view to another view and then back to the ‘home page’:
Thanks for the post! Glad I’m not the only person who has encountered it – was having a hard time figuring out if it was user error! Looking for a more ‘elegant’ solution though: I’m managing ~20 states, and I’m thinking I shouldn’t have to put ion-nav-buttons or ion-nav-back-button on every state. Think this may be a valid bug. I’ve tried every other workaround: removing <ion-nav-back-button> from menu.html, $ionicHistory.nextViewOptions({historyRoot:true}), $location.replace(), nav-clear on the link to home home/less nested state, and I can’t find anything that systematically fixes the issue…I don’t know of a use case in which this would be desired behavior, so this may be a valid bug.
FWIW, I’ve implemented another workaround for the issue I’ve experienced (clicking a link which takes you to your app’s main state, when you don’t want to display back, but logically in the history the back button should show) that doesn’t require sticking an <ion-nav-back-button> on every state you want it. The simple workaround is just adding this to whatever state you never want to show a back button for:
$scope.$on('$ionicView.beforeEnter', function (e,config) {
config.enableBack = false;
}