Search code examples
javascriptangularjsng-animate

Error including ngAnimate as a dependent module


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.

It works fine when using 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.

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!"

}]);

Solution

  • Something is wrong with cloudflare CDN. Try to use this url to 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