Avraam Mavridis
Avraam Mavridis

Reputation: 8920

Uncaught Error: [$injector:modulerr] on AngularJS

In the beginning of my html I've declare my application:

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

and at the bottom I have include all the necessary files, the Chrome does not complain for any missing file:

 <!-- Placed at the end of the document so the pages load faster -->
    <script src="js/jquery-1.11.0.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/angular.min.js"></script>
    <script src="js/angular-resource.min.js"></script>
    <script src="js/angular-route.min.js"></script>
    <script src="js/app.js"></script>
    <script src="js/Controllers/EventController.js"></script>
      <script src="js/Services/EventService.js"></script>
    <script src="js/filters.js"></script>

Here is my application:

'use strict';
// Declare app level module which depends on filters, and services
var MyAppModule = angular.module('MyAppModule', ['ngResource']).config(function($routeProvider){
    $routeProvider.when('/mybooks',{
            templateUrl:'/templates/mybooks.html',
            controller:'EventController'
        }
        );

});

But when I am trying to see the page there is a Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.2.14/$injector/modulerr?p0=MyAppModule&p1=Err…js.org%2F1.2.14%2F%24injector%2Funpr%3Fp0%3D%2524routeProvider%0A%20%20%20...<omitted>...2) on the browser. Any help? Am I missing something?

Upvotes: 1

Views: 2019

Answers (1)

Mike Thomsen
Mike Thomsen

Reputation: 37506

Try replacing this:

['ngResource']

With this:

['ngResource', 'ngRoute']

It looks like you're not injecting the route provider.

Upvotes: 4

Related Questions