Roman Dryndik
Roman Dryndik

Reputation: 1184

Strange error in angular-animate.js

I try to use ngAnimate module to create a simple animation. The problem is that every time I try to just include this module as a dependency I got this error: Error: Unknown provider: $animateProvider from ngAnimate.

The code is very simple, but I can't get what is the problem.

Here is my HTML template:

<html>
    <head>


        <script type="text/javascript" src="/js/lib/jquery-1.10.2.min.js"></script>

        <script type="text/javascript" src="/js/lib/angular.min.js"></script>

        <script type="text/javascript" src="/js/lib/angular-animate.js"></script>

        <script type="text/javascript" src="/js/lib/angular-cookies.min.js"></script>
        <script type="text/javascript" src="/js/lib/angular-resource.min.js"></script>
        <script type="text/javascript" src="/js/lib/angular-ui-router.min.js"></script>
        <script type="text/javascript" src="/js/lib/underscore-min.js"></script>


    </head>

    <!-- And so on -->

</html>

And I include ngAnimation in my module like this:

var myModule = angular.module('myModule', ['ngCookies', 'ngResource', 'ui.router', 'ngAnimate']);

Quite simple. Everything is like in this tutorial, nothing special. But it doesn't work. The same problem was on stackoverflow here, but useless...

So, can anybody explain me what is the problem?

Upvotes: 5

Views: 2043

Answers (4)

divyenduz
divyenduz

Reputation: 2027

Quoting another answer that helped me for future watchers of this post:

https://stackoverflow.com/a/24766563/1366216

Ran into the same problem. You have to match the version of angular to angular animate. change: "angular-animate": "1.2.6"

Crux is that you need to match angular version with angular-animate version.

Upvotes: 0

Roman Dryndik
Roman Dryndik

Reputation: 1184

All in all the problem was fixed by migrating to 1.2.13 version of AngularJS. I think that this error was occured bacause 1.0.8 doens't support it (or maybe it was some thing else).

Upvotes: 2

deddu
deddu

Reputation: 895

I fixed this error by updating to angular 1.2.13. Seems that for me was due to mismatching versions between angular 1.0.8 etc.

Upvotes: 1

Gilles
Gilles

Reputation: 167

In my experience, this type of error is usually due to wrong file references. Are you sure the path to angular-animate.js is correct? does it point to the right file? is the file present in your directory?

Upvotes: 0

Related Questions