Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

History (back button) not working when using side menus

$
0
0

+1 on this. I have a similar app, back works fine when moving from detail back to master, but $ionicHistory.backView() is always null when moving from one master view (those in the sidemenu) to the other. Help @mhartington

UPDATE

There's a fix in this stackoverflow post.

Basically the menu-close directive on menu items also resets the history stack.

use this directive instead:

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();
                }
            });
        }
    };
}]);

Works like a charm.


Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>