title: Close Modal Page from the inside of the Page
body: <p>I have a Page which I call via:</p>
  
  <pre><code>let profileModal = Modal.create(PopupPage);
  this.nav.present(profileModal);
  </code></pre>
  
  <p>How to close this modal page from my PopupPage-component:</p>
  
  <pre><code>import { ElementRef } from '@angular/core';
  import { Page } from 'ionic-angular';
  
  @Page({
      template: `
  &lt;ion-pane padding="" scroll="false"&gt;
      &lt;h2&gt;Login with...&lt;/h2&gt;
      &lt;p&gt;Please select one of our social logins. We'll never post anything your name
      &lt;button class="button button-default button-full button-danger" style="background-color: #3b5998;"&gt;&lt;i class="fa fa-facebook" aria-hidden="true"&gt;&lt;/i&gt; Facebook&lt;/button&gt;
      &lt;button class="button button-default button-full button-danger" style="background-color: #db3236;"&gt;&lt;i class="fa fa-google" aria-hidden="true"&gt;&lt;/i&gt; Google&lt;/button&gt;
  &lt;/ion-pane&gt;`,
      host: {
          "(document: click)": "globalClicked( $event )"
      }
  })
  export class PopupPage {
  
      constructor(private elmRef: ElementRef) {}
  
    globalClicked( event ) {
      if( !this.eventTriggeredInsideHost(event)) alert('NOW');
    }
  
    eventTriggeredInsideHost( event ) {
      var current = event.target;
      var host = this.elmRef.nativeElement.getElementsByTagName('ion-pane')[0];
  
      do {
        if ( current === host ) {
          return (true);
        }
        current = current.parentNode;
      } while ( current );
  
      return (false);
    }
  }
  </code></pre>