【发布时间】:2018-02-05 17:32:46
【问题描述】:
我添加了我的 Angular 项目的 bower 依赖项,但这些依赖项在 bower.json 文件中更新,而不是在 index.html 中。因此,我在 gulp 服务后收到Uncaught ReferenceError: angular is not defined 错误。
我试过bower install/bower install --save-dev。
bower.json
{
"name": "test",
"version": "0.0.0",
"dependencies": {
"angular": "^1.4.0",
"angular-animate": "^1.4.0",
"angular-cookies": "^1.4.0",
"angular-resource": "^1.4.0",
"angular-route": "^1.4.0",
"angular-sanitize": "^1.4.0",
"angular-touch": "^1.4.0"
},
"devDependencies": {
"angular-mocks": "^1.4.0",
"jquery": "^3.2.1"
},
"appPath": "app",
"moduleName": "testApp"
}
index.html
<!-- build:js(.) scripts/vendor.js -->
<!-- bower:js -->
<!-- endbower -->
<!-- endbuild -->
<!-- build:js({.tmp,app}) scripts/scripts.js -->
<script src="scripts/app.js"></script>
<script src="scripts/controllers/main.js"></script>
<!-- endbuild -->
【问题讨论】: