Nacim Idjakirene Nacim Idjakirene - 1 year ago 113
AngularJS Question

Angular 1.4.5 : Uncaught Error: [$injector:modulerr] ngRoute

When I try to refresh the page I have this error :



I have a simple module with a dependency of ngRoute:

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

app.config(function ($routeProvider) {

.when('/', {
templateUrl :'pages/main.html',
controller : 'mainController'


templateUrl : 'pages/second.html',
controller : 'secondController'


and my html code:

<html ng-app='myApp'>
<head><title>The title</title></head>
<script src="
<script src="">
<script src="app.js"></script>

<div ng-view>



Answer Source

Basically its typographical mistake.

It should be

<html ng-app='myapp'>

Instead of

<html ng-app='myApp'>

Additionally correct your script tags like below.

<script src=""></script>
<script src=""></script>          
<script src="app.js"></script>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download