In my angular cli project, I need to refer external js library which are not node packages. So, they will not be under node_modules folder as they are not installed by npm. These are loose js files.
- In angular cli project structure, where should I add them as a best
practice so that I can add them in scripts array in
.angular-cli.json file? - How do I use them in my typescript file?
Below link explains how do we refer them in scripts array of .angular-cli.json file. However, it doesn't tell about where should external js files be added in folder structure of angular cli project if they are not node modules.
Angular Cli Webpack, How to add or bundle external js files?
Best Answer
Add your external js file inside the assets folder like : assets=>js=>filename.js
.angular-cli.json
important after changes in .angular-cli.json file. Stop the project then start
How its use in ts file example below :
editor.js
editor.js will add in .angular-cli.json
in component.ts file