0

Hey after installing angular i made a simple routing script and for some reason the console is saying there is an error in the angular.min.js and i do not know why becuse i got it directly from the anularjs.org website. The console is showing this error.

Uncaught Error: [$injector:modulerr]
http://errors.angularjs.org/1.5.9/$injector/modulerr?p0=englishHosts&p1=Err…
localhost%2Fvendor%2Fbuild%2FAngularJavascript%2Fangular.min.js%3A21%3A332)
    at angular.js:38
    at angular.js:4683
    at q (angular.js:325)
    at g (angular.js:4644)
    at eb (angular.js:4566)
    at c (angular.js:1803)
    at Ic (angular.js:1824)
    at ue (angular.js:1709)
    at angular.js:32379
    at HTMLDocument.b (angular.js:3251)

My index.html has

<!DOCTYPE html>
<html lang="en" ng-app="englishHosts">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title></title>
    <link href="../vendor/libs/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="../vendor/libs/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <script src="../vendor/build/AngularJavascript/angular.min.js"></script>
    <script src="../vendor/build/AngularJavascript/angular-route.min.js"></script>
    <script>
      var app = angular.module("englishHosts", ["ngRoute"]);
    </script>
  </head>
  <body>
    <div ng-view></div>
  </body>
</html>

This error still occurs without the app.js. Any help would be helpful.

3
  • Try removing .. from the src attribute Commented Dec 16, 2016 at 19:28
  • Tried it still shows error Commented Dec 16, 2016 at 19:38
  • if you actually used angular.js instead of angular.min.js, the error would be clear. If I had to make a guess, it would be that ngRoute isn't loading right, since that is literally the only thing here that you are trying to access. Commented Dec 17, 2016 at 2:54

3 Answers 3

2

There is a 'modulerr' error because you don't define the module englishHosts.

Your app.js must contains something like this:

angular.module('englishHosts',[]);

And don't forget:

<script src="app.js"></script>

This appears in the http link : http://errors.angularjs.org/1.5.9/$injector/modulerr?p0=englishHosts...

(look at the p0 parameter in the url)

If you follow this 'error link', you will have some details.

Sign up to request clarification or add additional context in comments.

4 Comments

It shows solutions but i have tried those i am using 1.5.9 version witch is above 1.3.0 and it shows angular.module('ng').filter('tel', function (){}); is a bad practice but i declared it like var app = angular.module("englishHosts", ["ngRoute"]); so i really do not know why it is not working
var app = angular.module("englishHosts", ["ngRoute"]); is the only thing in app.js right now untill i figure out the error
The html you post don't have a link to your js file(s), is it normal?
It is linked and i am setting the angular.module correctly and i am still getting an error i will put a demo up so yall can see for yourself
0

I think the error you are seeing is because you are defining in the html

<html lang="en" ng-app="englishHosts">

and it cannot find the module called englishHosts

//  When this is commented out it will throw an error because it cannot find the module declared in the html !
// var app = angular.module("myApp",[]);
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>

<div ng-app="myApp" >
  
</div>

3 Comments

I defined it in the body and still getting error, no matter where i define it i still get the error
where is the js that defines the module ?
Srry i have not responded i was at work ill update my question
0
{
  "message": "Script error.",
  "filename": "",
  "lineno": 0,
  "colno": 0
}

1 Comment

Welcome to Stack Overflow! While this code may solve the question, including an explanation of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please edit your answer to add explanations and give an indication of what limitations and assumptions apply.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.