[SOLVED] Disable menu swipe for the all app


#1

Is it possible to generally disable the swipe of the menu for the all app?

I didn’t find something about it in the config (http://ionicframework.com/docs/api/config/Config/).

I know I could disable the swipe of the menu while adding following code (for example) in a root page but since I’ve got many roots, I would be happy if I would not have to add it in each of these

ionViewWillEnter {
   this.menuController.swipeEnable(false);
}

#2

How many menu’s do you have? What about controlling it from within a shared service? I assume you want to disable the sidemenu when some specific condition is valid? What’s your specific usecase?


#3

I’ve got two menus and well, way too may pages :wink:

I want to disable the swipe of the menu for all pages, because my main business pages, implement their own swipe action. For the user experience I found better when the swipe of the menu is, in such pages, disabled to avoid some surprises (sometimes while user/I do “big” swipe movement, instead of triggering the swipe action of the page, the swipe of the menu gonna be triggered, correct code behavior but surprising user experience).

Finally I just think that it’s a little bit surprising for the user that in some pages the menu is swipeable and that sometimes is not.

Well yes I could do a shared service, but I would still have to call it in every root pages right?

I thought that maybe I missed an option “general swipe of the menu: off” :wink:


#5

@luukschoen just had time to read your comment before your deleted it, you are fully right, I’m dumb.

<ion-menu swipeEnabled="false">

is what I’m searching


#6

yeah lol but I couldn’t find it back it the docs anymore… Decided to find it back first before posting the comment haha. I hate it when I propose a solution which I didn’t test/found myself earlier, that’s why I removed it. But you should use that. Thank god you’re a fast reader then :wink:


#7

Haha yes I’m happy I have read it fast otherwise you would have spent more time on it where I should just had been clever.

Thx a lot, really cool. A couple of code lines deleted, less code is always good :wink:

For the record it’s documented there:


#8

Haha there it is. I would have looked in the MenuController docs first so you definitely saved me some time as well :smile:


#9

:joy:

Thx a lot for the help, really appreciated.
Just tested it works like a charm.


#10

this is the right answer for Ionic 3, swipeBackEnabled="false" is not working for ionic 3