当我尝试拼接我的数组时,它会删除错误的数组,我认为它在拼接时与forEach的索引有关。 现在试了几个小时,无法让它工作:/
dpd.users.get(function (result) {
$scope.persons = result;
$scope.persons.forEach(function(entry, index) {
dpd.timesheets.get({user:entry.id}, function (result2) {
entry.timesheets = result2;
//splice person if timesheets of person is empty
if (entry.timesheets.length <=0){
$scope.persons.splice(index, 1);
}
......................