我正在尝试在我的Angular项目(https://clusterize.js.org/)中使用Clusterize.js库。
我从来没有在项目中导入过外部js库,并且我尝试在web上找到的东西失败了(添加模块、放置在assets中、加载到index.html中...)。总是出现错误,如模块集群化未找到、未定义或构造函数未定义等。
如何实现Clusterize.js?最佳实践是什么?
谢谢。
发布于 2019-01-28 22:42:26
在Angular项目中使用外部JavaScript库的最佳方法是:
在angular.json中声明JavaScript文件
{
...
"scripts": [
"node_modules/clusterize/clusterize.min.js"
]
}将其作为模块导入TypeScript文件中
import * as Clusterize from 'clusterize';
https://stackoverflow.com/questions/54404218
复制相似问题