未捕获对象错误:无法注入 ngAnimate

2024-02-19

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

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

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

我使用 Bower 安装了 ngAnimate。这是我的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:

<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?


遇到了同样的问题。您必须将 Angular 的版本与 Angular Animate 相匹配。

change:

“角度动画”:“1.2.6”

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

未捕获对象错误:无法注入 ngAnimate 的相关文章

随机推荐