title: How to load script file dynamically in app.component.ts(angular)?
body: <p>I am working in angular2 vs typescript. </p>
  
  <p>In my app.component.ts file i have to load the script files on demand based current navigator language. So i have added my function like below(home.component.ts),</p>
  
  <pre><code>export class HomeComponent {
  constructor() {
      this.loadDynmicallyScript();
    } 
  public loadDynmicallyScript() {
      let node = document.createElement('script');
      node.src = "../node_modules/xxxxxxxxxx/xx." +   navigator.language"+".min.js";
      node.type = 'text/javascript';
      document.getElementsByTagName('head')[0].appendChild(node);
   }
  </code></pre>
  
  <p>But this not works. But i have to load the files on demand based on current navigator language. How to achive this? Thanks for any help.</p>