加载 Angular 应用程序时出现错误。-
"TypeError: undefined is not a function"
我已经将问题范围缩小到与在 Controller 中声明 ngAnimate 以及第 504 行 Angular Animate 文件中首先抛出的错误有关 -
var hasClass = angular.$$hasClass(element[0], className);
这是我的 Controller 。即使包含 ngAnimate,一切都按照我想要的方式运行。
var tdfapp = angular.module('tdfapp', ['ngAnimate']);
tdfapp.controller('UserCtrl', function($scope, $http) {
$scope.users = [];
$http.get('user.json').success(function(data) {
angular.copy(data, $scope.users );
});
});
如有任何帮助,我们将不胜感激。
最佳答案
看起来我使用的是不同版本的 Angular 和 Angular Animate。
切换到 1.2.9 的稳定版本并解决了问题
关于angularjs - 类型错误:未定义不是函数 - Angular Animate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25893540/