下面是具有根據我的業務需要更改行,列的邏輯的代碼。當我把這個代碼,在我的Angular2 TS的代碼,我正在提供的參數根本不.forEach(符合調用對象的任何錯誤簽名......Angular2:ts - 提供的參數與調用目標的任何簽名不匹配
var data = [{ Id: "a", ColumnLocation: "0", RowLocation: "0" }, { Id: "b", ColumnLocation: "0", RowLocation: "1" }, { Id: "4", ColumnLocation: "0", RowLocation: "3" }, { Id: "c", ColumnLocation: "1", RowLocation: "0" }, { Id: "d", ColumnLocation: "1", RowLocation: "2" }, { Id: "e", ColumnLocation: "2", RowLocation: "0" }, { Id: "e", ColumnLocation: "2", RowLocation: "2" }];
data.forEach(function (col, row) {
return function (o) {
if (col !== o.ColumnLocation) {
col = o.ColumnLocation;
row = 0;
}
if (+o.RowLocation !== row) {
o.RowLocation = row.toString();
}
row++;
}
}());
哪裏是'data'?你有沒有我一個做'array.forEach'? –
什麼是數據?你使用'array'編輯:Bah。弗蘭克打我:) – mc01
它不是數組,它是數據。道歉.. – indra257