当我尝试将ngAnimate添加为依赖模块时,我收到错误.我知道这不是一个很好的问题,但我希望有人可以帮我弄清楚为什么我会收到错误.
使用JSFiddle:https://jsfiddle.net/m2jwb77h/3/时,它工作正常
但是我在浏览器中运行时遇到错误.当我删除ngAnimate作为依赖模块时,一切都很好,所以我知道这就是问题所在.
HTML:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script scr="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular-animate.js"></script>
<script src="ngAnimateTest.js"></script>
</head>
<body ng-app="myApp" ng-controller="myController">
{{test}}
</body>
</html>
JS:
var app = angular.module("myApp", ["ngAnimate"]);
app.controller("myController", ["$scope", function($scope) {
$scope.test = "It works!"
}]);
最佳答案 cloudflare CDN出了点问题.
尝试将此URL用于ngAnimate
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
Upd:错误是在拼写错误scr而不是src