Uses this code:
@HostListener(‘document:ionBackButton’, [’$event’])
private async overrideHardwareBackAction($event: any) {
await this.modalController.dismiss();
}
( Link : https://medium.com/@david.dalbusco/how-to-close-ionic-modals-using-the-hardware-back-button-aaddeb23dd35 )
Having a problem! See the link -> https://imgur.com/0oo1SSw
The problem with the code:
- It closes/dismiss modal is fine!
- But it also pushed back the page from where the modal is opened. Means it pop the page behind the modal.
This should not happen the page should not pop — only modal should close.