hi guys i want when device back button clicked if modal is open close it
Any update on this question.
Check this:
You’d be calling -> this.yourModal.dismiss()
In your modal component constructor:
// register back button to close this modal
this.platform.registerBackButtonAction(() => {
this.viewCtrl.dismiss();
});
In the page component where you call to open this modal:
// when modal is closed register back button to go back (default back button action)
let modalInstance = this.modalCtrl.create(ModalComponent);
modalInstance.onDidDismiss(() => {
this.platform.registerBackButtonAction(() => {
// if has history page go back
if (this.navCtrl.length() > 1) {
this.navCtrl.pop();
}
});
});
modalInstance.present();