Amacım, nesneden (tablo satırları olarak) bir dizi oluşturmaktır, ancak $ rootScope: infdig hatasını alıyorum. Ben benzer bir soru here gördük ama yardımcı olmadı
$scope.rows = {
"TableName": "TestTable",
"Rows": [{
"Name": "Name1",
"RowCells": [{
"Y": 2001,
"M": 164
}, {
"Y": 2002,
"M": 178
}, {
"Y": 2003,
"M": 188
}, {
"Y": 2007,
"M": 295
}, {
"Y": 2008,
"M": 316
}, {
"Y": 2009,
"M": 328
}]
}],
"Rows": [{
"Name": "Name2",
"RowCells": [{
"Y": 2001,
"M": 164
}, {
"Y": 2002,
"M": 178
}, {
"Y": 2003,
"M": 188
}, {
"Y": 2007,
"M": 295
}, {
"Y": 2008,
"M": 316
}, {
"Y": 2009,
"M": 328
}]
}],
"Rows": [{
"Name": "Name3",
"RowCells": [{
"Y": 2001,
"M": 164
}, {
"Y": 2002,
"M": 178
}, {
"Y": 2003,
"M": 188
}, {
"Y": 2007,
"M": 295
}, {
"Y": 2008,
"M": 316
}, {
"Y": 2009,
"M": 328
}]
}]
}
$scope.rowCells = function() {
var tableRowCollection = [];
angular.forEach($scope.rows, function (item) {
var tableRow = [];
tableRow.push(item.Name);
angular.forEach(item.RowCells, function (i) {
tableRow.push(i.M);
});
tableRowCollection.push(tableRow);
});
return tableRowCollection ;
};
<div data-ng-repeat="r in rowCells()">{{r}}</div>
:
İşte benim kodudur. neyim ya da nereye yanlış gidiyorum?
, benim nesnede bir hata oluştu ama bu örnek oluştururken ederken, gerçek nesne ok kaymış okunur. – agri