use*_*668 18 javascript angularjs yeoman
我是个新角色并遇到问题.我使用了yeoman角度生成器并添加了ngAnimate模块.当我运行时,grunt test我收到以下错误:
Error: [$injector:modulerr] Failed to instantiate module portfolioApp due to:
Error: [$injector:modulerr] Failed to instantiate module ngAnimate due to:
Error: [$injector:nomod] Module 'ngAnimate' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
Run Code Online (Sandbox Code Playgroud)
app.js
'use strict';
angular.module('portfolioApp', [
'ngAnimate',
'ngCookies',
'ngResource',
'ngSanitize',
'ngRoute'
])
Run Code Online (Sandbox Code Playgroud)
的index.html
<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<!-- build:js scripts/modules.js -->
<script src="bower_components/angular-animate/angular-animate.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
Run Code Online (Sandbox Code Playgroud)
bower.json
{
"name": "portfolio",
"version": "0.0.0",
"dependencies": {
"angular": "1.2.0",
"json3": "~3.2.4",
"es5-shim": "~2.1.0",
"jquery": "~1.10.2",
"greensock": "~1.11.2",
"angular-animate": "1.2.0",
"angular-resource": "1.2.0",
"angular-cookies": "1.2.0",
"angular-sanitize": "1.2.0",
"angular-route": "1.2.0"
},
"devDependencies": {
"angular-mocks": "1.2.0",
"angular-scenario": "1.2.0"
}
}
Run Code Online (Sandbox Code Playgroud)
我认为该模块应该加载,我无法弄清楚我做错了什么.有没有人有建议?
谢谢
mic*_*ael 31
我怀疑原因是:如果你运行grunt测试,karma任务将运行.karma的配置位于karma.conf.js文件中.你必须在files数组中添加angular-animate.js .
| 归档时间: |
|
| 查看次数: |
21290 次 |
| 最近记录: |