title: Importing a function from another TS file
body: <p>I am getting the following error: </p>
  
  <pre><code>ERROR TypeError: Cannot read property 'buttonToast' of undefined
  </code></pre>
  
  <p>when I am trying to import the buttonToast from another <code>.ts</code> file in <strong>ionic project</strong>. heres the code which I am trying:</p>
  
  <p><strong>firstfile.ts</strong></p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { ToastController, ToastOptions } from 'ionic-angular';
  
  @Injectable()
  export class ToastProvider { 
      toast: any;
      constructor(public toastCtrl: ToastController, public toastOptions: ToastOptions) {
  
      }
  buttonToast(toastMessage) {
      this.toast = this.toastCtrl.create({
          message: toastMessage,
          position: 'middle',
          showCloseButton: true,
          closeButtonText: "OK",
          cssClass: "sessionToast",
      });
      this.toast.present();
      }
  }
  </code></pre>
  
  <p><strong>secondfile.ts</strong></p>
  
  <pre><code>import { ToastProvider } from '../providers/toast/toast';
  import { Component,ViewChild } from '@angular/core';
  
  export class SignupPage {
      toastCtrl: ToastProvider
          constructor(public navCtrl: NavController, public navParams: NavParams) {
      }
  
      ionViewDidLoad() {
          console.log('ionViewDidLoad secondPage');
      }
  
  
      alertCtrl(){
          this.toastCtrl.buttonToast("Please sign in with your credentials");
      }
  }
  </code></pre>
  
  <p>I'm trying to call it when I click the function alertCtrl() from a button, from <code>some.html</code>.
  can any one say where i am doing the mistake ? </p>