Problem with uiGridConstants from ui-grid in Angular

0

My problem is when I want to do the following example of the documentation of a grid.

link

Specifically this function:

$scope.toggleVisible = function() {
    $scope.columns[0].visible = !($scope.columns[0].visible || $scope.columns[0].visible === undefined);
    $scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.COLUMN);
  }

When you run this line $scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.COLUMN);

tells me that uiGridConstants is undefined, so I can not get the table to update. I clarify that inject uiGridConstants in the corresponding controller

appAngular.controller('fillTableES', ['$scope', '$http', '$log', '$interval', '$rootScope', 'uiGridConstants', function ($scope, $watch, $http, $log, $interval, $rootScope, uiGridConstants) 

Thanks

    
asked by Matias Llanos 24.08.2016 в 23:07
source

1 answer

1

The problem is that you have defined $watch the parameters of the controller .. so the parameters do not coincide (remember they are applied in order, not the name of the variable) and the service remains undefined (one has 6 and the other has 7).

Delete it from the list of parameters, something like this:

appAngular.controller('fillTableES', 
        ['$scope', '$http', '$log', '$interval', '$rootScope', 'uiGridConstants', 
      function ($scope, $http, $log, $interval, $rootScope, uiGridConstants) 

Greetings.

    
answered by 25.08.2016 / 01:43
source