Angular UI Grid Get Cell Vaule
我正在使用角度网格ui,我正在尝试使用getCellValue获得基于行和列的单元格的值。
我得到了错误
无法获取未定义引用或null引用的属性“”$$undefined“”
如何从基于行和列的单元格获取Vaule值?
angular.module('app', ['ngAnimate', 'ngTouch', 'ui.grid','ui.grid.resizeColumns','ui.grid.pinning','ui.grid.grouping',
'ui.grid.moveColumns','ui.grid.exporter','ui.grid.selection','ui.grid.selection', 'ui.grid.cellNav']).controller('MainCtrl', MainCtrl);
MainCtrl.$inject = ['$http', 'uiGridConstants','$interval','$scope'];
function MainCtrl($http, uiGridConstants,$scope) {
var vm = this;
vm.gridOptions = { //vm
exporterMenuCsv: true,
enableGridMenu:true,
onRegisterApi: function(gridApi){
vm.gridApi = gridApi; //vm
}
};
$http.get('/getProjects')
.then(function(response) {
//Loop through the response
//If the vaule is 255 set the color of the cell to ect.
var responseData = response.data
console.log(vm.gridApi.grid.getCellValue(1,1));
//console.log(responseData[i].Iuk)
});
}
发布于 2018-06-05 07:37:39
注入数组与函数的参数不匹配:
MainCtrl.$inject = ['$http', 'uiGridConstants','$interval','$scope'];
function MainCtrl($http, uiGridConstants,$scope) {
从文档中:
$inject
属性批注
在使用这种类型的注释时,要注意使注释数组与函数声明中的参数保持同步。
— AngularJS Developer Guide - Dependency Injection
这个问题可以通过使用Implicit Annotation来避免。像ng-annotate这样的工具可以让你在你的应用中使用隐式依赖注解,并在最小化之前自动添加数组注解。
https://stackoverflow.com/questions/50686646
复制相似问题