Disable side menu conditionally


#1

I want to show side menu only when user logged in, is there a way I can conditionally enable or disable the slide menu?
I am doing this “”, this works when user not logged in and after logged, But when user logged out the menu still slide in (which should not be), and the menu content id blank…

Any idea?


Disabling a side menu
#2

Use the drag-content attribute.

http://ionicframework.com/docs/nightly/api/directive/ionSideMenuContent/

In a controller, you can change the value of the boolean.

<ion-side-menu-content
  drag-content="allowSideMenu">
</ion-side-menu-content>
$scope.allowSideMenu = false;

VERY old sample : http://plnkr.co/edit/WZFRfSfV2zVt1igpC3jY?p=preview


#3

References:


#4

FYI : Now see is-enabled

Sample : http://codepen.io/calendee/pen/mjtJL


#5

But this disabled the sidemenu swipe gesture on all other pages. Only way I am able to access the sidemenu is by toggling.


#6

That was the intent. Using this gives you the ability to decide what pages the side menu works on.

FYI : Lots of changes to side menus in the nightlies and the upcoming Beta 14. Might want to check those out as well.