1

I'm getting that Uncaught Error: [$injector:modulerr] error related to 1.2 and needing ngRoute installed. I read about that here and found this stack answer here.

However I followed all the steps, and am still getting this error.

I downloaded angular-route.min.js and added angular.module('app', ['ngRoute']); to my app.js file and am still getting the error :(

Not sure what gives, here is my test link: http://bitalicious.co/angular/

HTML:

<html ng-app="store">

<div>
    <p>{{"hello" + " you"}}</p>
</div>

<!-- JavaScript
================================================== -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="src/js/libs/angular.min.js"></script>
<script src="src/js/libs/angular-route.min.js"></script>
<script src="src/js/vendors/modernizr.min.js"></script>
<script src="src/js/vendors/bootstrap.min.js"></script>
<script src="src/js/modules/app.js"></script>

And my app.js:

$(document).ready(function () {
    var app = angular.modules('store', ['']);
    angular.module('app', ['ngRoute']);
});

enter image description here


Ok Update: I am using the Google hosted AngularJs instead of the files from AngularJS.org and I also remove document ready, I just have var app = angular.modules('store', []); in my app.js file. Now getting different errors:

enter image description here

Community
  • 1
  • 1
Leon Gaban
  • 36,509
  • 115
  • 332
  • 529
  • Don't put Angular definitions in a document.ready and don't use jQuery with Angular. – Zoey Mertes Sep 06 '14 at 22:48
  • Hmm, I'll remove the document ready code, but have to use jQuery, vanilla javascript is like Hebrew.... jk – Leon Gaban Sep 06 '14 at 22:52
  • No it's really not, and Angular makes it very easy to accomplish tasks. Either use Angular or use jQuery, don't use both in the same app. – Zoey Mertes Sep 06 '14 at 22:53
  • No way I can work without jQuery, I removed it and tested... still getting the same bug, so it's not related to jQuery. I use jQuery for effects and Dom manipulation, am expecting to use Angular for dynamic data. – Leon Gaban Sep 06 '14 at 22:57

2 Answers2

0

Ok apparently you can't have an angular.module named 'store' for some strange reason.

Once I changed this:
var app = angular.modules('store', []);
<html ng-app="store">

To:
var app = angular.module('gemStore', []);
<html ng-app="gemStore">

Now everytthing works :(

I'll leave this unchecked to give time for someone to leave and answer and comment as to why this is the case.

Leon Gaban
  • 36,509
  • 115
  • 332
  • 529
0

The problem was caused by missing inclusion of ngRoute module. Since version 1.1.6 it's a separate part:

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular-route.min.js"></script>

var app = angular.module('myapp', ['ngRoute']);

This is getting reference from: AngularJS 1.2 $injector:modulerr David answer

Arun Sharma
  • 869
  • 9
  • 9