I use the beta of ionic 4 for the first time. I try to disable the menu on a login page, but i have some trouble.
I\'ve created the app with ionic-cli and the sideme
Ionic 4.0.0 still supports ionViewWillEnter, use below code:
ionViewWillEnter() {
this.menuCtrl.enable(false);
}
You can find full example here.
This is the right way to do it
constructor(public menu: MenuController) {
this.menu.swipeGesture(false)
}
In my case in ionic 4 app, I did the following in welcome.page.ts file. welcome.page.ts is the page in which I want to hide split pane.
import { MenuController } from '@ionic/angular';
constructor( public menuCtrl: MenuController){}
ionViewWillEnter() {
this.menuCtrl.enable(false);
}
Ionic 4 you would use the disabled property on ion-menu to hide on login.
<ion-menu [disabled]="!isLoggedIn"></ion-menu>
Solved my issue using
<ion-menu [swipeGesture]="false" ...>
Instead of manually disabling it i think you should disable the swipe in ion-menu like this:
<ion-menu [content]="content" [swipeEnabled]="false">
Your code
</ion-menu>
<ion-nav [root]="rootPage" #content swipeBackEnabled="false"></ion-nav>
and in the login page
<ion-header>
<ion-navbar>
<ion-title text-center>Login</ion-title>
</ion-navbar>
</ion-header>
This way menu will be disabled in the Login Page.