How to disable side menu in ionic 4?
this.menuCtrl.enable(false);
This will also work in constructor. I am using this in an ionic v4 - beta.2 project and it works fine.
Also, I see that you are using ionic
with angular
so you can also OnInit lifecycle hook.
Try
this.menuCtrl.enable(false);
This also seems to be answered here disable menu on login page ionic 4
First, swipeEnable() is now swipeGesture().
Second, I had a similar problem with the MenuController and banged my head against a wall for longer than I'll disclose before realising it'd be wise to read the ionic core docs.
I had multiple side menus each with a unique id, set to false by default, which had to be enabled on particular pages. But MenuController wasn't recognising the id's I was passing in.
Concussed to the point of unconsciousness, I opened the ionic core docs on github and learned that MenuController now looks for menu-id, not id. So:
<ion-menu menu-id="myMenu">...
grabbed by, for example:
this.menuCtrl.enable(true, 'myMenu')
works.
As always in retrospect, both the new method and the solution to finding it seem so obvious.