Reputation: 815
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);
}
Upvotes: 1
Views: 732
Reputation: 1541
Even I have faced the same issue.
I have fixed this by using Events
.
If you try to navigate page from modal, You will face with above issue.(Side menu will not work). Instead of navigating from modal ts
, Try to navigate from parent ts
by using Events
.
Eg :
Parent ts :
events.subscribe('modal:finished', (page) => {
if(page == 'yourpage') {
this.navCtrl.push(YourPage);
}
});
Modal ts :
this.events.publish('modal:finished', 'yourpage');
You can send from modal where you need to redirect after modal dismiss. Based on this condition you can redirect wherever you want.
Hope it will help someone.
Upvotes: 0
Reputation: 858
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();
Upvotes: 1