disable menu on login page ionic 4

后端 未结 7 1510
北荒
北荒 2021-01-11 13:33

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

相关标签:
7条回答
  • 2021-01-11 14:08

    Ionic 4.0.0 still supports ionViewWillEnter, use below code:

    ionViewWillEnter() {
      this.menuCtrl.enable(false);
    }
    

    You can find full example here.

    0 讨论(0)
  • 2021-01-11 14:12

    This is the right way to do it

    constructor(public menu: MenuController) {
        this.menu.swipeGesture(false)
    }
    
    0 讨论(0)
  • 2021-01-11 14:13

    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);
    }
    
    0 讨论(0)
  • 2021-01-11 14:16

    Ionic 4 you would use the disabled property on ion-menu to hide on login.

    <ion-menu [disabled]="!isLoggedIn"></ion-menu>
    
    0 讨论(0)
  • 2021-01-11 14:16

    Solved my issue using

    <ion-menu [swipeGesture]="false" ...>
    
    0 讨论(0)
  • 2021-01-11 14:19

    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.

    0 讨论(0)
提交回复
热议问题