我必须使用Javascript Promise从后端读取一些信息,这是代码:
.then( function () {
for (var result in $scope.registrationsToAcceptAgreement) {
eventsServices.getGroupParticipants(
$scope.registrationsToAcceptAgreement[result].userRegistrations[0].groupName,
$scope.registrationsToAcceptAgreement[result].userRegistrations[0].eventId
)
.then( function (participantsResults) {
$scope.registrationsToAcceptAgreement[result].userRegistrations[0].participantsList = participantsResults;
});
}
}
})
假设应该为“ registrationsToAcceptAgreement [结果]”中的每个项目填写参与者列表,但仅填写最后一个元素。
为什么?