Disable drag on right menu but not the left menu

I have 2 menus, left and right. On the start view I want both menus to be swipe/draggable. But on all other views I don’t want the right menu to be draggable. Using $ionicSideMenuDelegate Im only able to disable both menus with canDragContent(false);

What’s the Ionic way to accomplish this?

To achieve this you’ll have to use the $getByHandle:

<ion-side-menu side="right" delegate-handle="right-menu">
</ion-side-menu>

In your controller:

$ionicSideMenuDelegate.$getByHandle('right-menu').canDragContent(false);

I can’t get it to work with $getByHandle.

Delegate for handle "right-menu" could not find a corresponding element with delegate-handle="right-menu"! canDragContent() was not called!
Possible cause: If you are calling canDragContent() immediately, and your element with delegate-handle="right-menu" is a child of your controller, then your element may not be compiled yet. Put a $timeout around your call to canDragContent() and try again. 

If I put delegate-handle directive in ion-side-menus instead of ion-side-menu this message don’t occur but it doesn’t help me disable only the right menu.

What am I doing wrong?

It seems like the delegate-handle is meant for the parent <ion-side-menus>, so I’m not sure how you can target only one menu within that instance.

hello there, right now I am developing an app using ionic and it would really be a lot of help if there is an existing way to easily solve this now? thanks in advance.

1 Like

Hi guys,
any update about this?

nope sorry :pensive:

Hi!

A possible solution is use on-drag-left=“foo()” in .

I say this:

With foo function:
$scope.foo = function ()
if(you stay in start view)
{
$ionicSideMenuDelegate.canDragContent(true);
}
else
{
$ionicSideMenuDelegate.canDragContent(false);
}

You must check in the function that view are you in each moment.

Best regards!