I'm getting the error "Unknown provider: $routeProvider" even though I have ngRoute
as dependency and have included angular-route.js
in the HTML files
var customerAppModule = angular.module("customerApp", ['ngRoute']);
customerAppModule.config(['$routeProvider',
function ($routeProvider) {
$routeProvider.
when('/MainMenu', {
templateUrl: 'Home/MainMenu.html',
controller: 'CheckCtrl'
}).
when('/Index', {
templateUrl: 'Home/Index.html',
controller: 'MainCtrl'
}).
otherwise({
redirectTo: '/MainMenu'
});
}]);
Usually this error appears when angular-route.js is not loaded for some reason.
The said project has mismatched versions for angular and its module:
<script data-require="angular.js@1.4.0-beta.6" data-semver="1.4.0-beta.6" src="https://code.angularjs.org/1.4.0-beta.6/angular.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-route.js"></script>
This can result in injector failure but will also produce other errors.