How can i import external js file in Angular 5?

允我心安 提交于 2019-12-11 01:11:28

问题


I need to use external js in my angular 5 project. My example like this: https://codepen.io/sfdsfssdfdf/pen/opJpJM

I added angular-cli.json file to this strings

"styles": [
    ...
    "../node_modules/jquery-minicolors/jquery.minicolors.css",
    "./assets/css/main.css",
    "./assets/css/style.css" **(i added style.css to css fold)"
  ],
"scripts": [
    ...
    "../node_modules/clipboard/dist/clipboard.min.js",
    "./assets/js/app.js",
    "./assets/js/index.js" **( i added index.js to js folder)
  ],

and i added html codes to app.component.html

But I'm getting some error Error from console :

Uncaught ReferenceError: angular is not defined at scripts.bundle.js:28099 at scripts.bundle.js:28146

What shall i do for solution in this case ?

来源:https://stackoverflow.com/questions/48349460/how-can-i-import-external-js-file-in-angular-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!