Kor*_*rte 0 javascript json push http angularjs
我有一个带对象的数组.我需要为每个对象添加一个键,它将是一个其他对象的数组.
所以我的代码看起来像这样:
$scope.array = [];
$http.get(url).success(function(data) {
$scope.array = data;
// Now my array has some objects
var i = 0;
function() getSomeData(i) {
if(i<array[i].length()) {
$http.get(url + array[i].someKey).success(function(data){
$scope.array[i].push(data);
i++;
getSomeData(i);
})
}
}
})
getSomeData(0);
Run Code Online (Sandbox Code Playgroud)
但我得到了 Error:array.push is not a function
为什么会这样?
| 归档时间: |
|
| 查看次数: |
1442 次 |
| 最近记录: |