title: Prevent going back when hardware back button is pressed in Ionic 4 App
body: <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    this.platform.backButton.subscribe(()=&gt; {
           const alert = await this.alertController.create({
           header: 'Confirm!',
           message: 'Do you want to go back!!!',
           buttons: [
           {
              text: 'Yes',
              handler: () =&gt; {
              // Previous page loaded
           }
           }, {
              text: 'No',
              handler: () =&gt; {
                //Page should not go back.
                //This is where i want to write code,if the user clicks 
                No and the back button function should be disabled.
                //Only when the user presses Yes,the page will go to 
                previous.
                }
              }
           ]
        });
      })</code></pre>
  </div>
  </div>
  </p>
  
  <p>I dont know how to handle when the user presses no,i.e.Disable the back button function or event.</p>