解决方法
您必须使用行模板.在此模板中,您可以使用ng-class并通过数据绑定动态分配CSS类.
一个简单的例子:
<body ng-controller="MyCtrl"> <div class="grid" ng-grid="gridOptions"></div> </body>
JavaScript的
var app = angular.module('myApp',['ngGrid']); app.controller('MyCtrl',function($scope) { $scope.fileOneUploaded = true; $scope.fileTwoUploaded = false; $scope.gridData = [{fileName: 'File 1',size: 1000,isUploaded: $scope.fileOneUploaded },{fileName: 'File 2',size: 2000,isUploaded: $scope.fileTwoUploaded }]; $scope.gridOptions = { data: 'gridData',rowTemplate: '<div style="height: 100%" ng-class="{red: !row.getProperty(\'isUploaded\')}">' + '<div ng-repeat="col in renderedColumns" ng-class="col.colIndex()" class="ngCell ">' + '<div ng-cell></div>' + '</div>' + '</div>' } });
CSS
.grid { width: 300px; height: 100px; border: solid 1px rgb(90,90,90); } .red { background-color: red; color: white; }