如果您使用的角度CLI您可以包括.js
从你的文件node_modules
在你的.angular-cli.json
.
在styles
数组下面,environmentSource
你应该看到scripts
数组.我已经包含了一些(我已经截断它)JSON作为参考.
{ "apps": [ { "root": "src", "outDir": "dist", "assets": [ "assets", "favicon.ico" ], "index": "index.html", "main": "main.ts", "styles": [ "styles.scss" ], "scripts": [ "../node_modules/hammerjs/hammer.min.js" ], "environmentSource": "environments/environment.ts", "environments": { "dev": "environments/environment.ts", "prod": "environments/environment.prod.ts" } } ] }