uiGridConstants 未定义(但它们被传递给控制器​​)

uiGridConstants undefined (but they are passed in to controller)

正在尝试获取 uigrid 中我的列值的聚合。我已经将 uiGridConstants 注入到控制器中,并且在我的 app.js 中我有 ui.grid... 但是,无论我做什么,uiGridConstants 都被传回为未定义。有人知道吗?

网格选项

$scope.gridOptions = {
  infiniteScrollRowsFromEnd: '50',
  selectionRowHeaderWidth: '100',
  enableColumnMenus: false,
  rowHeight: '45',
  enableFiltering: true,
  columnDefs: [
    { field: 'name', name: 'Name', width: '*', cellTemplate: '<div class="ui-grid-cell-contents"><a ui-sref="contacts-profile({ id: row.entity.id })">{{COL_FIELD}}</a></div>'},
    { field: 'type', name: 'Type', width: '*' },
    { field: 'status', name: 'Status', width: '*' },
    { field: 'premium', name: 'Premium', width: '*', cellTemplate: '<div class="ui-grid-cell-contents">${{COL_FIELD}}</div>', aggregationType: uiGridConstants.aggregationTypes.count },
    { field: 'commission', name: 'Comission', width: '*', cellTemplate: '<div class="ui-grid-cell-contents">${{COL_FIELD}}</div>' },
    { field: 'created_by', name: 'Created by', width: '*' }
  ]
};

喷油器

constructor($scope, $location, CognitoService, $http, uiGridConstants, uiGridGroupingConstants) {

PoliciesCtrl.$inject = ['$scope', '$location', 'CognitoService', '$http', '$q', '$timeout', '$filter', 'uiGridConstants', 'uiGridGroupingConstants'];

如果我执行 uiGridConstantsconsole.log 我得到

ƒ $Q(resolver) {
        if (!isFunction(resolver)) {
          throw $qMinErr('norslvr', 'Expected resolverFn, got \'{0}\'', resolver);
        }

        var promise = new Promise();

        function resolveFn(v…

尝试以下操作:

constructor($scope, $location, CognitoService, $http,  $q, $timeout, '$filter', uiGridConstants, uiGridGroupingConstants) {

PoliciesCtrl.$inject = ['$scope', '$location', 'CognitoService', '$http', '$q', '$timeout', '$filter', 'uiGridConstants', 'uiGridGroupingConstants'];

注入和构造函数中的参数数量和顺序必须相同。