AngularJS错误:模块ngAnimate不可用 [英] AngularJS Error: Module ngAnimate is not available
本文介绍了AngularJS错误:模块ngAnimate不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我'新的角度并运行到的一个问题。我用的是自耕农角发电机和补充ngAnimate模块。当我运行咕噜测试
我收到以下错误:
I'am new to angular and running into a problem. I used the yeoman angular generator and added the ngAnimate module. When I run grunt test
I get the following error:
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.
app.js
'use strict';
angular.module('portfolioApp', [
'ngAnimate',
'ngCookies',
'ngResource',
'ngSanitize',
'ngRoute'
])
的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>
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"
}
}
我觉得这个模块就可以加载,我想不出有什么我'做错了。有没有人有什么建议?
I think the module should be loaded and i can't figure out what i'am doing wrong. Does anyone have suggestions?
感谢
推荐答案
我怀疑的理由是:如果你运行的咕噜测试的,善缘任务运行。对于因果报应的配置在karma.conf.js文件。在那里,你必须在文件添加角animate.js 的数组。
I suspect the reason is: If you run grunt test, the karma task will run. The configuration for karma is in the karma.conf.js file. There you must add angular-animate.js in the files array.
这篇关于AngularJS错误:模块ngAnimate不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文