{ "Chemistry - II": [ { "id": "9", "title": "Solid State", "quecount": 12 }, { "id": "10", "title": "Solutions", "quecount": 9 }, { "id": "11", "title": "Electrochemistry", "quecount": 8 }, { "id": "6", "title": "d and f- Block elements", "quecount": 42 } ], "Physics": [ { "id": "3", "title": "Circular Motion", "quecount": 5 } ] }
我想總結了「quecount」,但未能取得結果總和從對象
$scope.chlist;
for (i = 0; i < $scope.chlist.length; i++)
{
total += $scope.chlist[i].quecount;
}
$scope.totque = total;
幫助的JSON數組的價值將得到高度讚賞。 謝謝。
你總需要爲所有的單獨物理和化學或全部? –