Javascript AngularJS类型错误:d未定义-Firefox,angular route.min.js:7未捕获类型错误:无法读取属性';isArray';未定义的铬

Javascript AngularJS类型错误:d未定义-Firefox,angular route.min.js:7未捕获类型错误:无法读取属性';isArray';未定义的铬,javascript,angularjs,google-chrome,firefox,requirejs,Javascript,Angularjs,Google Chrome,Firefox,Requirejs,我正在开发一个基于AngularJS的响应性单页web应用程序,其中显示了一些数据,我可能遇到了一个与RequireJS相关的问题。我在使用Firefox时收到d未定义,并且未捕获类型错误:无法读取未定义的属性'isArray',但刷新Chrome后,一切看起来都正常(与Firefox不兼容)。代码如下: RequireJS配置: requirejs.config({ baseUrl: 'js', paths: { angular: [ 'lib/angular.min',

我正在开发一个基于AngularJS的响应性单页web应用程序,其中显示了一些数据,我可能遇到了一个与RequireJS相关的问题。我在使用Firefox时收到
d未定义
,并且
未捕获类型错误:无法读取未定义
的属性'isArray',但刷新Chrome后,一切看起来都正常(与Firefox不兼容)。代码如下:

RequireJS配置:

requirejs.config({
baseUrl: 'js',
paths: {
    angular: [
    'lib/angular.min',
    'https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min'
    ],
    angularRoute: [
    'lib/angular-route.min',
    'https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular-route.min'
    ]
}
});
剧本

define(['angular','angularRoute'], function($) {

var app = angular.module("myModule", ["ngRoute"]) 
                 .config(function($routeProvider) { 
                    $routeProvider
                        .when("/home", { 
                            templateUrl: "templates/home.html",
                            controller: "homeController" 
                        })
                        .when("/repositories", {
                            templateUrl: "templates/repositories.html",
                            controller: "repositoriesController"
                        })
                        .when("/contributors", {
                            templateUrl: "templates/contributors.html",
                            controller: "contributorsController"
                        })
                        .otherwise({
                            redirectTo: "/home"
                        })
                 })
                 .controller("homeController", function($scope) {
                    $scope.headingOne = "App description";

                 })
                 .controller("repositoriesController", function($scope, $http, $log) {
                    $http.get('https://api.github.com/users/x-formation/repos')
                        .then(function(response) {
                            $scope.gitHub = response.data;
                        })
                    $scope.headingTwo = "X-Formation public repositories";  
                    $scope.sortColumn = "forks_count";
                    $scope.reverseSort = true;

                    $scope.sortData = function(column)  {
                        $scope.reverseSort = ($scope.sortColumn == column) ? !$scope.reverseSort : false;
                        $scope.sortColumn = column;
                    }

                    $scope.getSortClass = function (column) {
                        if ($scope.sortColumn == column) {
                        return $scope.reverseSort ? 'arrow-down' : 'arrow-up';
                        }
                    return '';
                    }
                 })
                 .controller("contributorsController", function($scope, $http) {
                    $http.get('http://cors.io/?u=https://www.x-formation.com/wp-content/uploads/2014/09/contributors.json')
                        .then(function(response) {
                            $scope.xFormationData = response.data;
                        })
                    $scope.headingThree = "Top contributors";   
                    $scope.sortColumn = "contributions";
                    $scope.reverseSort = true;

                    $scope.sortData = function(column)  {
                        $scope.reverseSort = ($scope.sortColumn == column) ? !$scope.reverseSort : false;
                        $scope.sortColumn = column;
                    }

                    $scope.getSortClass = function (column) {
                        if ($scope.sortColumn == column) {
                        return $scope.reverseSort ? 'arrow-down' : 'arrow-up';
                        }
                    return '';
                    }
                 })

});

我最近才开始,我觉得这有点超出我的能力范围,但我最终还是要知道这一点

代码中最突出的是require语句:

定义(['angular','angularRoute'],函数($){

您需要传递的不是
$
符号,而是
angular

另外,您的require设置缺少一些垫片设置。请阅读本文,看看这是否解决了您的问题