Reputation: 11
I'm trying to use the Clusterize.js library in my Angular project (https://clusterize.js.org/).
I have never imported an external js library in projects, and I am failing trying what I found on the web (add module, place in assets, load in index.html...). Always errors like module Clusterize not found, undefined, or constructor not defined etc...
How to implement Clusterize.js ? What are the best practices ?
Thank you.
Upvotes: 1
Views: 653
Reputation: 4787
Best way to use an external JavaScript library in an Angular project is :
Declare JavaScript file in angular.json
{
...
"scripts": [
"node_modules/clusterize/clusterize.min.js"
]
}
Import it in your TypeScript file as module
import * as Clusterize from 'clusterize';
Upvotes: 2