i want to loop over this array of object but i don’t know why is don’t enter to this loop , i try foreach too but nothing
Component.ts
cvs:Cv[]=[];
CandidatAllInformation:any =
{
NOM:'',
PRENOM:'',
DATE_NAISSANCE:'',
TELEPHONE:'',
EMAIL:'',
DIPLOME:'',
INSTITUT:'',
ANNEE_SCOLAIRE:'',
MENTION:'',
SPÉCIALITÉ:'',
TYPE_EXPERIENCE:'',
DATE_DEBUT:'',
ENTREPRISE:'',
DEPARTEMENT_SERVICE:'',
};
constructor(public cvService: CvService,public candidatService: CandidatService,public userService: UserService,public centreInteretService:CentreInteretService,public experienceService:ExperienceService,public formationService:FormationService,public langueService:LangueService,public specialiteService:SpecialiteService) { }
ngOnInit(): void {
this.cvService.getCvs().then((res:any)=>{
console.log(res);
this.cvs=res.data;
console.log(this.cvs)
}).catch((err:any)=>{
console.log(err);
})
this.Afficher();
}
Afficher(){
for (let element of this.cvs) {
console.log("gfgf")
this.candidatService.getCandidat(element.IDCANDIDAT).then((res:any)=>{
this.myCandidat=res.data;
}).catch((err)=>{
console.log(err);
})
this.formationService.getFormation(element.IDFORMATION).then((res:any)=>{
this.myFormation=res.data;
}).catch((err)=>{
console.log(err);
})
this.specialiteService.getSpecialite(element.IDSPECIALITE).then((res:any)=>{
this.mySpecialite=res.data;
}).catch((err)=>{
console.log(err);
})
this.experienceService.getExperience(element.IDEXPERIENCE).then((res:any)=>{
this.myExperience=res.data;
}).catch((err)=>{
console.log(err);
})
this.CandidatAllInformation =
{
NOM:this.myCandidat.NOM,
PRENOM:this.myCandidat.PRENOM,
DATE_NAISSANCE:this.myCandidat.DATENAISSANCE,
TELEPHONE:this.myCandidat.TELEPHONE,
EMAIL:this.myCandidat.EMAIL,
DIPLOME:this.myFormation.DIPLOME,
INSTITUT:this.myFormation.INSTITUT,
ANNEE_SCOLAIRE:this.myFormation.ANNEESCOLAIRE,
MENTION:this.myFormation.MENTION,
SPÉCIALITÉ:this.mySpecialite.INTITULE,
TYPE_EXPERIENCE:this.myExperience.TYPE,
DATE_DEBUT:this.myExperience.DATEDEBUT,
ENTREPRISE:this.myExperience.ENTREPRISE,
DEPARTEMENT_SERVICE:this.myExperience.DEPARTEMENTSERVICE
};
this.resultCandidat=this.CANDIDATS=[this.CANDIDATS , ...this.CandidatAllInformation];
}
console.log("result");
console.log(this.resultCandidat);
}
}