You can add a JavaScript file to your Angular app by adding a scripts
property to your app project in the Angular app's workspace file (aka angular.json
in your project's root directory):
{
"version": 1,
// ...
"projects": {
"my-app": {
// ...
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
// ...
"scripts": [
// JavaScript file goes here
"js/le.min.js",
// Note: The `scripts` property accepts an array of objects or an array of strings
// See https://github.com/angular/angular-cli/blob/c5de8e3b0e5c1499a0a17da0208297cd82b36095/packages/angular_devkit/build_angular/src/browser/schema.json#L390-L419 for more info
]
// ...
}
// ...
}
// ...
}
}
// ...
}
Alternatively, you can set this with the ng config
command:
# Replace my-app with your actual project name in your angular.json file
ng config projects.my-app.architect.build.options.scripts[0] js/le.min.js