I'm relatively new to working with Typescript and I'm facing a challenge that seems quite silly:
When I fetch an 'agent' object from a service.
this.agentsController.getAgent(matricule).subscribe({
next: agent => {
console.log(agent)
console.log(agent.emailPro)
},
error: (error: string) => {
console.log(error)
}
});
Based on the first console.log, the object is properly populated :
{
"agent": {
"matricule": "000001",
"nom": "DummyName",
"prenom": "DummyFirstname",
"emailPro": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5c38293131251c3829313125723a2e">[email protected]</a>",
"adresse1": "dummy address",
"telephonePerso": "0000000001"
}
}
Despite having a clearly defined email address in the agent printout (emailPro), the second console.log always displays undefined
How does this happen? What am I overlooking?