I am using, this.menuCtrl.swipeEnable(false);
for ionic 3 app. This works fine for disabling the side menu. But, it doesn't work for ionic 4! Below is my ionic 4 code sample:
login.page.ts
constructor(public loginService: LoginService, private router: Router, public menuCtrl: MenuController) {
this.menuCtrl.swipeEnable(false);
}
app.component.html
<ion-app>
<ion-split-pane>
<ion-menu type="push">
<ion-header>
<ion-toolbar color="success">
<ion-title>Menu</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-list>
<ion-menu-toggle auto-hide="false" *ngFor="let p of appPages">
<ion-item [routerDirection]="'root'" [routerLink]="[p.url]">
<ion-icon slot="start" [name]="p.icon"></ion-icon>
<ion-label>
{{p.title}}
</ion-label>
</ion-item>
</ion-menu-toggle>
</ion-list>
</ion-content>
</ion-menu>
<ion-router-outlet main></ion-router-outlet>
</ion-split-pane>
</ion-app>
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.