Ionic history stack when using side menu and tabs
ionic-framework
Solution
This is due to the fact that the menu-close directive resets the history stack (as explained here).
If you remove "menu-close" from your elements, then you keep the history, but loose some of the expected behaviour.
As a solution, you can develop your own directive (let's say "menu-close-keep-history") to replace the "menu-close" one.
myModule.directive('menuCloseKeepHistory', ['$ionicHistory', function($ionicHistory) {
return {
restrict: 'AC',
link: function($scope, $element) {
$element.bind('click', function() {
var sideMenuCtrl = $element.inheritedData('$ionSideMenusController');
if (sideMenuCtrl) {
$ionicHistory.nextViewOptions({
historyRoot: false,
disableAnimate: true,
expire: 300
});
sideMenuCtrl.close();
}
});
}
};
}]);
This should do the trick.
Problem
I am having some troubles with ionic and its history stack when using side menus and tabs. I created a plunker example here: http://embed.plnkr.co/XK6seY9mDypTW6GcsCpj/preview Steps to follow to get to the problem: - Open side menu - Navigate to "Master List" - Choose one of the items - You'll get redirected to the general-data-tab of the detail page The problem is that there's no back-button displayed in navigation by ionic itself. I created an own back button that calls $ionicGoBack($event) to see whether ionic has the history stack or not. But when clicking this button you'll see that ionic does not navigate back to the master-list, instead you'll stay on the general-data-tab of the detail page. Can anyone tell me what the problem is? I am aware of tabs having their own history stack, nevertheless the tab should know its ancestor, or am I wrong? Many thanks in advance for your help! Best regards