AngularJS: $$selectors undefined when trying to use ngAnimate

梦想的初衷 提交于 2019-12-25 16:55:32

问题


This is driving me up the wall! I am trying to use angular-animate.js but some reason the line $$selectors property of $$animateProvider (line 451) is undefined. Can someone explain how this property gets populated?

This situation is causing the lookup function at line 617 to throw "TypeError: Cannot read property '' of undefined"

My js includes look like this:

<script src="lib/jquery/jquery.js"></script>
<script src="lib/bootstrap/js/bootstrap.js"></script>
<script src="lib/angular/angular.js"></script>
<script src="lib/angular-sanitize/angular-sanitize.js"></script>
<script src="lib/angular-route/angular-route.js"></script>
<script src="lib/angular-animate/angular-animate.js"></script>
<script src="lib/angular-bootstrap/ui-bootstrap-tpls.js"></script>

CSS includes like this:

<link rel="stylesheet" href="app/css/bootstrap.css" />
<link rel="stylesheet" href="lib/animate-css/animate.css"/>

and my app.js like this:

var app = angular.module('app', [
    // Angular modules (dependencies)
    'ngRoute',          // routing
    'ngSanitize',       // sanitizes html bindings (ex: sidebar.js)
    'ngAnimate',        // animations
    'ui.bootstrap'      // ui-bootstrap (ex: carousel, pagination, dialog)
]);

The frustrating thing was that this was working but I've somehow broken it. I've tried cleaning and downloading all the libraries again. Any help greatfully received!

I am using Gulp and Bower to download/import. All the files are present and being loaded by the browser:

TypeError: Cannot read property '' of undefined
at lookup (angular-animate.js:617)
at animationRunner (angular-animate.js:681)
at performAnimation (angular-animate.js:1284)
at angular-animate.js:959
at angular-animate.js:539
at Scope.$get.Scope.$digest (angular.js:15606)
at Scope.$get.Scope.$apply (angular.js:15824)
at done (angular.js:10263)
at completeRequest (angular.js:10435)
at XMLHttpRequest.requestLoaded (angular.js:10376)

回答1:


This is due to a version conflict with angular 1.4 and angular-material master, which depends on 1.3.

Probably updating your angular version ""angular": ">=1.4."," in bower.json should solve this problem.



来源:https://stackoverflow.com/questions/30508497/angularjs-selectors-undefined-when-trying-to-use-nganimate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!