[英]Angular Service HttpClient API requests 404 in production, but not locally
[英]Angular 11 HttpClient Generic Observable map service values into a Class
我正在使用 .net 中的 POST 服務,該服務返回下一個結構,該服務正確返回數據
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;
}
當我嘗試在控制台 'val.Success' 中打印時,它會打印 undefined,?? 為什么會這樣??
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!!
有人可以幫助我嗎!! 我很感激!!
您的圖像顯示小寫success
,但您嘗試記錄標題Success
。 改成
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;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.