问题
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