How To Prevent hardware back button to close ionic Modal


I’m using Ionic 4 with Angular 8
I want to “Disable” modal dismiss when i press android hardware “back” button.

this.platform.backButton.subscribe(() => {
      console.log("Button Pressed");

I can trace the event but i can’t prevent ionic to dismiss modal.

Set a variable to the var. For example let alert = …