我创建了以下数组:
$scope.testAccounts[0] = { id: 99, name: "Select Account" };
我尝试过
$scope.testAccounts.push(result.data);
where results.data看起来可能是这样的:
[{ id: 1, name: "x" },{ id: 2, name: "y" }]
然而,这似乎并不起作用,因为它试图将数组作为第二个元素添加。我需要的是将数组result.data的内容附加到数组$scope.testAccounts中。
请注意,到目前为止我看到的所有示例似乎都无法处理对象数组。这正是我所拥有的。谢谢。