Nacim Idjakirene Nacim Idjakirene - 1 month ago 12
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>




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>