Search code examples
ionic2angular2-modal

Ionic2 menuToggle is not working after Modal.present


My side menu or menu toggle code is in the app.compnent.ts. This menu toggle is working perfectly in all the pages before I click Modal. MenuToggle is not working after I click the button for Modal. I'm not sure what is the exact issue. Any suggestions please?

Menu:

<ion-icon name="menu" menuToggle float-left margin-right></ion-icon>

PageA:

pageBModal() {
  let modal = this.modalCtrl.create(PageB);
  modal.present();
}

PageB:

  closeModal() {
    this.viewCtrl.dismiss();
    this.navCtrl.setRoot(DashBoardPage);
  }

Solution

  • you can use MenuController

    import { MenuController } from 'ionic-angular';
    constructor(public menuCtrl: MenuController) {
     }  
         If you want to close menu please use close() event
    
          this.menuCtrl.close()
    
         If you want to open menu please use open() event
    
          this.menuCtrl.open();