[SOLVED] Disable menu swipe for the all app

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);
}
3 Likes

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?

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:

@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

5 Likes

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:

2 Likes

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:

1 Like

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

:joy:

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

1 Like

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

If anyone is viewing this in 2024 or later (ionic 6 at this time): swipe-gesture=“false”
Kudos to this guy who answered here: angular - Disable swipe to view sidemenu ionic 2 - Stack Overflow)%20method%20(Ionic%20docs).