userlkjsflkdsvm userlkjsflkdsvm - 1 month ago 8
TypeScript Question

Ionic Menu won't appear if modal is selected

When the user logs into the app, they are greeted with a modal. Once entering in data to this modal - they can continue to the logged in page. This page should have a menu included. The menu appears because I'm calling this.menu.enable on the home page, however, when selected, the menu doesn't appear. The menu works if I remove the modal after the user logs in. So some part of the modal is disabling the menu I'm assuming. Even on menu.open() the menu won't appear but when removed, the open functionality works and the menu opens on start.

Modal.ts

export class ModalPage {
items: Item[] = [];

constructor(public navCtrl: NavController,public loadingCtrl: LoadingController,public user: Login, public viewCtrl: ViewController, public navParams: NavParams, public menu: MenuController){

}

login(){
this.menu.enable(true)
this.doSignup()
}

doSignup() {
this.navCtrl.push(HomePage, {someId: someId});
}

dismiss() {
this.viewCtrl.dismiss(this.items);
}

}


HomePage.ts

constructor( public menu: MenuController) {
this.menu.enable()
}

Answer Source

Your model handling is wrong.You need to follow below code.

You can read more about it here under the Navigating from an Overlay Component title.

Modal.ts

    constructor(public navCtrl: NavController,public loadingCtrl: 
      LoadingController,public user: Login, public viewCtrl: ViewController, 
      public navParams: NavParams,  public menu: MenuController,public appCtrl: App){
    }

    doSignup() {
     this.dismiss();
     this.appCtrl.getRootNav().push(HomePage, { someId: someId });
    }