title: Call pure javascript function from Angular 2 component
body: <p>I have one file that have dozens javascript functions. What I want to do is to import that file into Angular 2 component and run init() function that is defined in "external.js" file.</p>
  
  <pre><code>import { Component, AfterViewInit } from '@angular/core';
  
  import "../../../../assets/external.js";
  
  @Component({
      selector: 'app-component',
      templateUrl: 'app.component.html'
  })
  export class ComponentNameComponent implements AfterViewInit {
      constructor() { }
  
      ngAfterViewInit(): void {
        // invoke init() function from external.js file
      }
  }
  </code></pre>
  
  <p>external.js is loaded using import and in ngAfterViewInit() I want to invoke init() function that is in external.js that calls all other methods in that external file. </p>
  
  <p>Here is part of external.js:</p>
  
  <pre><code>function init() {
    callFunction1();
    callFunction2();
  }
  </code></pre>