[Fixed]-Cannot read property 'module' of undefined


Have you forgotten to load AngularJS before your script? The error means that the object angular hasn’t been seen by Javascript yet and therefore module cannot be called on it.

(that’s actually a simplification but it should illustrate what’s going on)


order matters here

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


<script type="text/javascript" src="angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular-cookies.js"></script> 
<script type="text/javascript" src="angular-route.js"></script>

you have to put angular.min.js before angular-route.js and angular-cookies.js

Leave a comment