I have following items in ionic side menu list.
Home (contains nested states like books, games,etc.)
Profile
About
By default from profile or about pages there is no back button in nav bar and app exits on using androids hardware back button.
I want Profile and About page to go back to Home on tapping hardware back button (which is the standard way in most apps today) and I would also like to have back button in header nav bar that links to home.
How can I achieve this in ionic?
You need to remove the menu-close attribute from the menu items that you want a back button to show on. This directive clears the navigation stack and sets the next view as the history root. This should give you your desired result.
Thanks it works. After removing menu-close, backbutton is showing but side menu remains open so i added menu-toggle attribute to menu items to close the menu.
Is there any other option other then menu-toggle that can close the side menu ?
Hi, I need this solution too. The side menu remain open. What is the proper way to have Back link and also close the side menu? Please advice, thank you.
Hi, I just tried add menu-toggle=“left” and it works. Close the side menu plus with back button. Hope this help.
You could add ng-click="toggleLeft()"
to the menu item, and then define a function that toggles the menu:
$scope.toggleLeft = function() {
$ionicSideMenuDelegate.toggleLeft();
};
Either way will close the menu.
$ionicSideMenuDelegate docs