3

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 ?

  • 2
    Possible duplicate of [How to include external js file in Angular 4 and call function from angular to js](https://stackoverflow.com/questions/44817349/how-to-include-external-js-file-in-angular-4-and-call-function-from-angular-to-j) – Aravind Jan 19 '18 at 21:01
  • 1
    İ did same thing in the this post.But i already getting error.Something different in Angular 5 – Ahemt Demir Jan 19 '18 at 21:03

0 Answers0