Here is a code snippet showcasing a $http request to retrieve quizzes and their respective results. The problem lies in the fact that 'i' is representing obtained values instead of index.
$http.get(url).success(function(response) {
$scope.quizes = response.quizes;
for(var i=0; i<$scope.quizes.length; i++){
$http.get('url?filter=quizId,eq,' + $scope.quizes[i].id +'&transform=1').success(function(i, response){
return function (result){
$scope.quizes[i].results = response;
}
}(i, response));
}
});
How can we address this issue effectively?