Allow menu drag in views with back button

I have a simple menu on the left which can be opened with the hamburger button and by sliding the page. This works great.

However, when I go one level deeper (so the back button appears), I want the hamburger button for the menu to disappear, as it needs to be replaced with the back button. This works when using the <ion-side-menus enable-menu-with-back-views="false"> is used, which is the default setting (if I’m correct).
However, I can not slide to open the menu, in fact, a slide action is not doing anything at all. When the above mentioned option is set to true, the slide action work, but the back button and the hamburger button are both displayed: something I do not want.

Can somebody help me solve this? Basically I only want to hide the menuToggle when there is a back button visible, or to enable the ‘drag-for-menu’ in all views. Maybe I can use something like ng-if for the first solution, but hopefully there is a nice Ionic solution.

I’ve found a solution for my problem, which I would like to share with you. It is actually fairly simple.

Use the <ion-side-menus enable-menu-with-back-views="true"> for your menu definition, and add the following directive to your app:

angular.module('yourmodule').directive('menuToggle', function() {
      return {
        restrict: 'AC',
        link: function($scope, $element, $attr) {
          $scope.$on('$ionicView.beforeEnter', function(ev, viewData) {
            if (viewData.enableBack) {

It simply hides the menuToggle button on every view which has the back button enabled. The removal of the hide class is handled by the original menuToggle directive, which is still available and executed.

Using the above code which you have posted, it still does not solve my problem. On swipe menu section should be shown on any screen but its not happening. The same code of yours if I run on the emulator it works but not on the real device .Does the ionic version matters.??

@mhartington Any comments on this ? Because this is an important functionality of the app.

Any kind of help is appreciated.

The code I posted in this topic is only meant to hide the menu button in the view (to replace it with the back button) when the navigation goes deeper than 1 level. It has nothing to do with the enabling the slide to open menu animation.

To enable the swipe for opening the menu when you are a level deeper, you will need to set <ion-side-menus enable-menu-with-back-views="true">, instead of false. By default, I guess that the swipe to open menu is enabled. See for the documentation.

The code which you have written is hide the menu button, that I understand. I had also used enable-menu-with-back-views=“true”, so that in all the views on swipe I could see menu page. So when I did that it worked perfectly on the emulator but not on my phone (RedMi) and also on Alcatel phone.

Then once again I tested on a different phone (Moto E) there the swipe functionality worked.

Why is this happening, works on some phone and not in some phones. Can you help me in this.?

I have no idea why this might be happening. Might have something to do with the Android versions or hardware performance? Maybe Ionic disables it (or cannot enable it) when a incompatible webview is found… But you might want to start another topic on that.