Skip to content Skip to sidebar Skip to footer

Cannot Read Property 'module' Of Undefined

I have a basic understanding of Django and JS and recently I started learning Angular.js. I wrote code for showing hardcoded json using Angular and failed. I got the following erro

Solution 1:

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)


Solution 2:

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>

Solution 3:

<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


Post a Comment for "Cannot Read Property 'module' Of Undefined"