I'm farly new with Typescript and struggle with what seems to be a dumb issue:
I retrieve 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)
}
});
According to the 1st console.log, it is well populated :
{
"agent": {
"matricule": "000001",
"nom": "DummyName",
"prenom": "DummyFirstname",
"emailPro": "dummy@dummy.fr",
"adresse1": "dummy address",
"telephonePerso": "0000000001"
}
}
But as clearly as the print of the agent shows a well defined email address (emailPro), the 2nd console.log always shows undefined
How is that possible ? What am I missing ?