0

I work on my AngularJS tutorial.

I get this error:

Error: [$injector:modulerr] Failed to instantiate module sensorManagement due to:
[$injector:unpr] Unknown provider: $routeProvider
http://errors.angularjs.org/1.4.2/$injector/unpr?p0=%24routeProvider
minErr/<@http://localhost:7486/Scripts/angular.js:68:12
createInjector/providerCache.$injector<@http://localhost:7486/Scripts/angular.js:4264:19
getService@http://localhost:7486/Scripts/angular.js:4411:39
invoke@http://localhost:7486/Scripts/angular.js:4443:1
runInvokeQueue@http://localhost:7486/Scripts/angular.js:4358:11
loadModules/<@http://localhost:7486/Scripts/angular.js:4367:11
forEach@http://localhost:7486/Scripts/angular.js:336:11
loadModules@http://localhost:7486/Scripts/angular.js:4348:5
createInjector@http://localhost:7486/Scripts/angular.js:4274:11
bootstrap/doBootstrap@http://localhost:7486/Scripts/angular.js:1630:20
bootstrap@http://localhost:7486/Scripts/angular.js:1651:1
angularInit@http://localhost:7486/Scripts/angular.js:1545:5
@http://localhost:7486/Scripts/angular.js:28361:5
trigger@http://localhost:7486/Scripts/angular.js:2998:7
createEventHandler/eventHandler@http://localhost:7486/Scripts/angular.js:3273:9

Here is my module definition:

(function () {
    "use strict";
    var myApp = angular.module("sensorManagement", ["ngResource"])
        .config(function ($routeProvider, $locationProvider) {
            $routeProvider.when('/Registration/Courses', { templateUrl: '/templates/courses.html', controller: 'CoursesController' });
            $routeProvider.when('/Registration/Instructors', { templateUrl: '/templates/instructors.html', controller: 'InstructorsController' });
            $locationProvider.html5Mode(true);
        });
}());

Any idea what can cause to the error above?

2 Answers 2

1

There is separate module for angular route after angular 1.2.0 release

you need to add angular-route.js and dependency as,

angular.module("sensorManagement", ["ngResource","ngRoute"])

check the DOCUMENT.

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

Comments

1

you missed injecting angular-route in your module definition

 angular.module('sensorManagement', ['ngRoute'])

Comments

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.