title: How to call an Angular 4 method from a standalone plain JavaScript function?
body: <p>I'd like to be able to pass some data\propagate events from a plugin on the page to my Angular 4 app.</p>
  
  <p>More specifically, in my case data\events are generated inside a Silverlight plugin app that is next to the Angular app on the page.</p>
  
  <p>I have the following solution in my mind:</p>
  
  <ul>
  <li>Create a global JS function which gets called from Silverlight (since this seems to be the simplest way to get data out from Silverlight) when
  there is a need to talk to Angular side.</li>
  <li>The function, in turn, calls some Angular class method passing data
  collected from Silverlight.</li>
  </ul>
  
  <p>As an illustration to that (excluding the Silverlight part), we could have the following.</p>
  
  <p>A method as an entry point on the Angular side:</p>
  
  <pre><code>export class SomeAngularClass {
      public method(data: any): void {
          ...
      }
  }
  </code></pre>
  
  <p>And somewhere outside the Angular realm, we add a global plain JavaScript function (to be called by Silverlight):</p>
  
  <pre><code>window.somePlainJsFunction = function (data) {
      // How to consume SomeAngularClass.method() from here?
  }
  </code></pre>
  
  <p>The question is: <strong>how can we call the Angular class methods from a plain JavaScript function?</strong></p>