I'm consuming a POST service in .net that returns the next structure, the service return data correctly
public sendExcelInBase64ToBackEnd(data: any) {
this.customOptions = {
headers: this.customHttp.buildHeader(),
};
this.customHttp.Post<SerialResultDTO>('/serialsExcel', data, this.customOptions).subscribe(val => { // <- val data returns ok
this.serialResult = val;
let x = this.serialResult.Success;
console.log(x);
console.log(val.Success); // <- prints undefined
})
return null;
}
When I try print in console 'val.Success' it prints undefined!!, Why this happens??
I want assign all atributes to a custom class in angular, but in chrome debug it shows object data, but in time of asign to my model class it gets undefined!!
Someone can help me please!! I appreciate that!!
Your image shows a lowercase success
, but you try to log a titlecase Success
. Change to
public sendExcelInBase64ToBackEnd(data: any) {
this.customOptions = {
headers: this.customHttp.buildHeader(),
};
this.customHttp.Post<SerialResultDTO>('/serialsExcel', data, this.customOptions).subscribe(val => {
this.serialResult = val;
let x = this.serialResult.success;
console.log(x);
console.log(val.success);
})
return null;
}
Thanks moxximanagarm your are correct, the service returns in lowercase, I changed It and It works now!!!
Hi @Chris. R. , happy that you got the needed answer, you may like to mark the answer as accepted and/or upvote it?. That will motivate others to reserve more of their time for answering questions and helping eachothers.