Angular ui-grid TypeError: Cannot read property 'SELECT' of undefined

Angular ui-grid TypeError: Cannot read property 'SELECT' of undefined

我已经为这个错误苦苦挣扎了一段时间, 我正在尝试为 ui-grid 上的过滤器函数创建一个下拉列表,但我似乎得到一个 TypeError: Cannot read 属性 'SELECT' of undefined,错误发生在行中类型:说明 uiGridConstants.filter.SELECT。

这是我的代码:


var columnDefs = [
            {name: "Updated by", field: "updatedBy", enableHiding: false, enableSorting:true, width: "*",enableFiltering: false},
            {name: "Date Updated", field: "updatedDateTime", enableHiding: false, enableSorting:true,width: "*",enableFiltering: false},
            {name: "Action Group", field: "actionGroup", enableHiding: false,enableSorting: true,
                filter: {
                    type: uiGridConstants.filter.SELECT,
                    selectOptions: groupTypes
                }
            },
            {name: "Action Performed", field: "actionPerformed", enableHiding: false, width: "75%"}
        ];

我尝试按照 ui-grid 教程页面上的 guide 进行操作,但将 运行 保留在该错误中 谢谢

找到问题的原因,基本上是我将 uiGridConstants 以错误的顺序传递给函数,例如:

它是什么:

XXX.controller('XXXController', ['$location', '$scope','uiGridConstants', '$route', '$http', function ($location, $scope, $route, $http,uiGridConstants)

应该是什么:

XXX.controller('XXXController', ['$location', '$scope','uiGridConstants', '$route', '$http', function ($location, $scope,uiGridConstants, $route, $http)

我知道这是一个非常愚蠢的错误,但希望有一天有人会看到这个,而不是像我一样浪费时间