5

Import Javascript libraries in Angular

 3 years ago
source link: https://marco.dev/2018/05/05/import-javascript-in-angular/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

How to import a JavaScript library in Angular

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"
      ],

Author

Marco Molteni

Marco Molteni Blog


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK