Side menu doesn't work after using navctrl to push page from modal page

Hi, i faced a problem with side menu, it doesn’t work when i use navCtrl to push page from a modal page,

Have you considered changing the logic of your project such that the page is pushed after focus has returned to the Modal Caller?

You could make use of onDidDismiss to determine if a page needed to be pushed.

Hi, yes when i used this.viewCtrl.dismiss(); and the side menu button works but i don’t see the new data, but when i go back from modal page using push the side menu doesnt work and i can see the data updated

Can you post the code?

yes sure,

heres the modal storelistDetail.ts

this.serviceProvider.call(“POST”, ‘core/modules/eav/entity/update’, this.payLoad).then(
res => {
this.callRes = res;
console.log(“callRes”);
this.navCtrl.push(StorelistPage);
}, err => {
console.log("Error chart list ")
}
);

and in the storelist Page i have the side menu button
menu() {
console.log(“menu button”);
this.menuCtrl.open();
}

but i create the menu in the app.html i just call it from store list page

I pulled this from the docs. Based upon what you are stating, it appears that you are not emitting the data.

Try this, specifically passing the data from the modal into this.viewCtrl.dismiss(DATA TO PASS TO MODAL CALLER GOES HERE).

import { Component } from ‘@angular/core’;
import { ModalController, ViewController } from ‘ionic-angular’;

@Component(…)
class HomePage {

constructor(public modalCtrl: ModalController) {

}

presentProfileModal() {
let profileModal = this.modalCtrl.create(Profile, { userId: 8675309 });
profileModal.onDidDismiss(data => {
console.log(data);
});
profileModal.present();
}

}

@Component(…)
class Profile {

constructor(public viewCtrl: ViewController) {

}

dismiss() {
let data = { ‘foo’: ‘bar’ };
this.viewCtrl.dismiss(data);
}

}

thank you so much bro for your reply, i found the solution , inside modal.onDidDismiss i refresh my page so now i can dismiss the modal page and refresh my page also

const modal = this.modalCtrl.create(AdddevicebufferPage,{I});
modal.onDidDismiss(() => {
this.ionViewWillEnter();
});
modal.present();
}

I guess the Menu still works?

Yes, now the sidemMenu works perfectly ))

1 Like