Import Javascript libraries in Angular

Updated: 2018-05-05

In this example we show how to import a JS library in your Angular project generated by the CLI.

Add the library to your project

Include the JS file in your path, e.g.: src/assets/js.

Modify angular-cli.json

Add the library to your angular-cli.json, e.g:

  "scripts": [ 
        "../node_modules/jquery/dist/jquery.min.js", 
        "../src/assets/css/hl/highlight.pack.js", 
        "../src/assets/js/autotrack.js" 
      ], 

WebApp built by Marco using Java 21 - Hosted in Switzerland