错误包括ngAnimate作为依赖模块

时间:2021-03-29 23:17:15

I'm getting an error when I try to add ngAnimate as a dependent module. I know this isn't a great question, but I'm hoping someone can help me figure out why I'm getting an error.

当我尝试将ngAnimate添加为依赖模块时,我收到错误。我知道这不是一个很好的问题,但我希望有人可以帮我弄清楚为什么我会收到错误。

It works fine when using JSFiddle: https://jsfiddle.net/m2jwb77h/3/

使用JSFiddle时它工作正常:https://jsfiddle.net/m2jwb77h/3/

But I get the error when running it in my browser. When I remove ngAnimate as a dependent module everything is fine, so I know that's where the problem is.

但是我在浏览器中运行时遇到错误。当我删除ngAnimate作为依赖模块时,一切都很好,所以我知道这就是问题所在。

HTML:

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:

JS:

var app = angular.module("myApp", ["ngAnimate"]);
app.controller("myController", ["$scope", function($scope) {

    $scope.test = "It works!"

}]);

1 个解决方案

#1


1  

Something is wrong with cloudflare CDN. Try to use this url to ngAnimate

cloudflare CDN出了点问题。尝试将此URL用于ngAnimate

    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>

Upd: the error was in typo scr instead of src

Upd:错误是在拼写错误scr而不是src

#1


1  

Something is wrong with cloudflare CDN. Try to use this url to ngAnimate

cloudflare CDN出了点问题。尝试将此URL用于ngAnimate

    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>

Upd: the error was in typo scr instead of src

Upd:错误是在拼写错误scr而不是src