title: Inject an Angular service into an exported function
body: <p>I have an injectable service to show toast messages. I want to use it in another typescript file where i only have some exported functions.</p>
  
  <p>Here is my service</p>
  
  <pre><code>import { Injectable } from "@angular/core"; 
  import { NotifierService } from "angular-notifier";
  
  @Injectable({
    providedIn: "root"
  })
  export class Notifier {
    notifier: NotifierService;
  
    constructor(private notifierService: NotifierService) {
      this.notifier = this.notifierService;
    }
  
    notifiy(type, message) {
      this.notifierService.notify(type, message);
    }
  }
  </code></pre>
  
  <p>And this is the exported function in which i need to show some toasts based on conditions. This is contained in another typescript file.</p>
  
  <pre><code>export function validateFile(file) {
  let type = getFileType(file.name);
  let size = file.size;
  switch (type) {
      case "image": {
        if (size &gt; 10000000) {
          return false;
        } else {
          return true;
        }
      }
  
  case "audio": {
    if (size &gt; 200000000) {
      return false;
    } else {
      return true;
    }
  }
  
  case "video": {
    if (size &gt; 300000000) {
      return false;
    } else {
      return true;
    }
  }
  
  case "compress": {
    if (size &gt; 200000000) {
      return false;
    } else {
      return true;
    }
  }
  
  default: {
    return false;
  }
    }
  }
  </code></pre>
  
  <p>How to use the notify method from notifier service in this function??</p>