未捕获的对象错误:无法注入 ngAnimate [英] uncaught object error: can't inject ngAnimate

查看:38
本文介绍了未捕获的对象错误:无法注入 ngAnimate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试像这样注入ngAnimate"时,我无法实例化我的应用:

I can't instantiate my app when I try to inject 'ngAnimate' like so:

var app = angular.module('musicsa', [
  'ngCookies',
  'ngResource',
  'ngSanitize',
  'ui.router',
  'firebase',
  'ngAnimate'
]) 

我从 angular.js 第 78 行收到一个错误 Uncaught object

I get an error Uncaught object from angular.js line 78

我使用 bower 安装了 ngAnimate.这是我的 bower.json:

I installed ngAnimate using bower. Here's my bower.json:

{
  "name": "ang-changeorg",
  "version": "0.0.0",
  "dependencies": {
    "angular": "1.2.6",
    "json3": "~3.2.6",
    "es5-shim": "~2.1.0",
    "jquery": "~1.10.2",
    "bootstrap": "~3.0.3",
    "angular-resource": "1.2.6",
    "angular-cookies": "1.2.6",
    "angular-sanitize": "1.2.6",
    "firebase": "~1.0.11",
    "angularfire": "~0.7.1",
    "spin.js": "~2.0.0",
    "angular-ui-router": "~0.2.10",
    "angular-animate": "~1.2.16"
  },
  "devDependencies": {
    "angular-mocks": "1.2.6",
    "angular-scenario": "1.2.6"
  },
  "resolutions": {
    "angular": "1.2.6"
  }
}

并且我将所有脚本包含在我的 index.html 中:

And I include all the scripts in my index.html:

<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.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/firebase/firebase.js"></script>
<script src="bower_components/firebase-simple-login/firebase-simple-login.js"></script>
<script src="bower_components/angularfire/angularfire.js"></script>
<script src="bower_components/spin.js/spin.js"></script>
<script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>

如果我从我的模块声明中删除 'ngAnimate' 一切正常.为什么我不能使用 ngAnimate?

If I remove 'ngAnimate' from my module declaration everything works. Why can't I use ngAnimate?

推荐答案

遇到了同样的问题.您必须将 angular 的版本与 angular 动画相匹配.

Ran into the same problem. You have to match the version of angular to angular animate.

改变:

"angular-animate": "1.2.6"

"angular-animate": "1.2.6"

这篇关于未捕获的对象错误:无法注入 ngAnimate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆