When attempting to utilize an array to achieve a specific outcome, I encounter the cannot read property of undefined error. Oddly enough, when I console log the same property, I get the desired result. Below is my code:
for (var j=0;j<$scope.ftListe.length;j++){
if(task[j].projet_id==id){
if(temp!=task[j].NomTache)
temptache.push(task[j]);
tempcol.push(lecollaborateur[j]);
}
temp=task[j].NomTache;
}
$scope.temptache=temptache;
$scope.tempcol=tempcol;
for(var i=0; i<temptache.length;i++){
for (var k=0;k<$scope.ftListe.length;i++){
console.log("l'id de la tache: "+temptache[i].IdTache);
if(temptache[i].IdTache==$scope.ftListe[k].tacheid){
temps = temps+$scope.ftListe[k].TempsPasse;
passe= passe+$scope.ftListe[k].TempsPasse * lecollaborateur[k].CoutParJour;
}
}
tempsAr.push(temps);
passeAr.push(passe);
temps=0; passe=0;
}
The issue arises with the IdTache
property. What could be causing this error?