为什么角度给喷油器模块错误?

为什么当视图呈现时抛出了以下错误

未捕获错误:[$ injector:modulerr]由于以下原因无法实例化模块registrationModule:错误:[$ injector:unpr]未知提供者:$ routeProvider http://errors.angularjs.org/1.5.0/$injector/unpr?p0 = http:// localhost:2044 / Scripts / angular.js:68:12上的%24routeProvider位于http:// localhost:2044 / Scripts / angular.js:4397:19上getService(http:// localhost:2044 /在Object.invoke(http:// localhost:2044 / Scripts / angular.js:http:// localhost:2044 / Scripts / angular.js:4574:58)处的injectArgs脚本/ angular.js:4550:39)在http:// localhost:2044 / Scripts / angular.js:4506:11处forEach(http:// http:// localhost:2044 / Scripts / angular.js:4497:35) (http:// localhost:2044 / Scripts / angular.js:321:20)在loadModules(http:// localhost:2044 / Scripts / angular.js:4487:5) js:4409:19)http://errors.angularjs.org/1.5.0/$injector/modulerr?p0=registrationModule&...jector%20(http%3A%2F%2Flocalhost%3A2044%2FScripts%2Fangular.js%3A4409 %3A19)

这里是我的route configuration

var registrationModule = angular.module("registrationModule", [])
    .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);
    });

在MVC5中使用Angular JS


你需要包含'ngRoute'。

var registrationModule = angular.module("registrationModule", ['ngRoute'])
    .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);
    });
链接地址: http://www.djcxy.com/p/77679.html

上一篇: why angular gives the injector module error?

下一篇: another injector issue