title: global function in Ionic 2 / Angular 2
body: <p>How can I setup a global function that can be accessed throughout all views? </p>
  
  <p>In app.component.ts I added a simple method </p>
  
  <pre><code>  openShare() {console.log("button clicked")} 
  </code></pre>
  
  <p>and then in my nav I have </p>
  
  <pre><code>  &lt;button ion-button right (click)="openShare()"&gt;
    &lt;ion-icon name="md-share"&gt;&lt;/ion-icon&gt;
  &lt;/button&gt;
  </code></pre>
  
  <p>When I try to access this from any page I get the following. </p>
  
  <pre><code>self.context.openShare is not a function
  </code></pre>
  
  <p>It does however execute fine if I put it directly in the constructor (e.g this.openShare(); ), but when calling from any page using a (click) function it just doesn't work. </p>
  
  <p>Is app.component.ts not global? I thought this is where I would place it, but maybe I am missing something.  </p>
  
  <p>Basically its a function for a simple button on the nav, I need it to be global though since its used on every page. </p>
  
  <p>Any help would be appreciated, still figuring Ionic 2 out. </p>