Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 安格拉斯。未知提供程序-路由图_Angularjs_Angular Routing - Fatal编程技术网

Angularjs 安格拉斯。未知提供程序-路由图

Angularjs 安格拉斯。未知提供程序-路由图,angularjs,angular-routing,Angularjs,Angular Routing,我曾多次使用类似的代码,但从未出现任何错误,但现在,当我需要读取url参数时,出现了一些错误。 以下是应用程序配置的一部分: angular.module('NitkaApp', [ 'ngMaterial', 'ngMessages', 'ngRoute', 'ngResource', 'ngSanitize', 'books', 'details', 'authors', 'images', 'dataServi

我曾多次使用类似的代码,但从未出现任何错误,但现在,当我需要读取url参数时,出现了一些错误。
以下是应用程序配置的一部分:

angular.module('NitkaApp', [
    'ngMaterial',
    'ngMessages',
    'ngRoute',
    'ngResource',
    'ngSanitize',
    'books',
    'details',
    'authors',
    'images',
    'dataService'
]).
    config([
        "$locationProvider", "$routeProvider", "$mdThemingProvider", function ($locationProvider, $routeProvider, $mdThemingProvider) {
            $locationProvider.html5Mode({
                enabled: true
            });
            $mdThemingProvider.theme('default')
                .primaryPalette('blue-grey')
                .accentPalette('brown');
            $routeProvider
                .when('/', {
                    templateUrl: '/app/html/books.html',
                    controller: 'BooksCtrl'
                })
                .when('/book/:id', {
                    templateUrl: '/app/html/book-details.html',
                    controller: 'BookDetailsCtrl'
                })
这是控制器的一部分:

(function () {
    "use strict";
    angular.module('details', []).controller("BookDetailsCtrl", ["$scope", "$location", "$rootParams", "$mdMedia", "NitkaService", function ($scope, $location, $rootParams, $mdMedia, NitkaService) {
        //Getting external data from service
        NitkaService.getBook($rootParams.id).then(function(d) {
            $scope.bookDetails = d.data;
        });

当然,我有角路由库链接。你能建议解决这个问题吗?当然,我读过所有类似的帖子。

它应该是

routeParams
在控制器的依赖项中,更改

来自

angular.module('details', []).controller("BookDetailsCtrl", ["$scope", "$location", "$rootParams", "$mdMedia", "NitkaService", function ($scope, $location, $rootParams, $mdMedia, NitkaService) {
        //Getting external data from service
        NitkaService.getBook($rootParams.id).then(function(d) {
            $scope.bookDetails = d.data;
        });

 angular.module('details', []).controller("BookDetailsCtrl", ["$scope", "$location", "$routeParams", "$mdMedia", "NitkaService", function ($scope, $location, $routeParams, $mdMedia, NitkaService) {
        //Getting external data from service
        NitkaService.getBook($routeParams.id).then(function(d) {
            $scope.bookDetails = d.data;
        });

$rootParams
?你是说
$routeParams
?该死的,我怎么会犯这样的错误?因为这是一个如此简单的打字错误,所以最好还是这样关闭它。。。