Piotr___ Piotr___ - 1 year ago 100
AngularJS Question

enableSelection and uiGridConstants

I'm trying to get rows selectable only with a certain

The console returned a
ReferenceError: uiGridConstants is not defined

I have to admit that I don't fully understand what uiGridConstants stands for.

Here is my code:

onRegisterApi: function (gridApi) {

this.gridApiBatches = gridApi;

gridApi.grid.options.enableSelection = function (row) {
if (row.entity.$treeLevel != 3) {
return false;
} else {
return true;

Answer Source

uiGridConstants is module and you have to inject it as dependency into your controller just like you inject $scope.


app.controller('SurveyReportController', ['$scope', 'uiGridConstants',
    function($scope, uiGridConstants) {

        \\ your angular controller code here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download