var sanitizedresult=[];
angular.forEach(voteResult, function(value, key) {
// console.log(value.poll_watcher_id);
var param={
id : value.candida
var sanitizedresult=[];
var processVotes = function(voteResult,idx){
var param={
id : voteResult[idx].candidate_id
}
CandidateService.getCandidatInfo(param).then(function(success){
// console.log(success);
console.log(idx+"Thi is it");
var row = {
ballot_name: success,
vote_count: voteResult[idx].count
}
console.log(row);
sanitizedresult.push(row);
if(idx < voteResult.length-1){
processVotes(voteResult,idx+1);
}
},function(fail){
console.log(fail);
if(idx < voteResult.length-1){
processVotes(voteResult,idx+1);
}
});
}
processVotes(voteResult,0);
console.log(sanitizedresult);
There are no errors but still the sanitizedresult is empty what will be the possible cause why the "sanitizedresult" is empty