[英]Jitsi Meet works on Firefox and Microsoft Edge but not on Chrome
[英]Subscribe() method not works in Microsoft Edge
我正在使用subscribe()
獲取json
格式的值。 此值顯示在屏幕中。
問題是在Microsoft Edge中此方法無效。 它返回了HttpResponse
0的錯誤。但是,在Chrome和Firefox中可以正常工作。
這是我的代碼:
if (this.machine.length === 0) {
this.simulatorService.getAks(this.codIm, this.codCS)
.subscribe(
data => {
console.log('works!');
this.machine= data;
},
error => {
console.log(error);
this.machine= [];
}
);
}
因此,我需要使用除.subscribe()
之外的其他方法? 什么?
那么,使代碼在Microsoft Edge上運行的最佳方法是什么?
---------- 更新1 -----------
這段代碼是我的getAsks
。 這是一條返回帶有一些數據的json文件的路由。
getAsks(codIm: codIm, codCS: codCS): Observable<Array<Equip>> {
return this.http.get<Array<Equip>>(
`${this.urlBase}v1/simulator/machine/${codIm}/${codCS}`,
{
headers: new HttpHeaders({
'Content-Type': 'application/json'
})
});
}
錯誤無效的HttpResponse可能是因為您的api未返回正確的標頭。 因此,我建議您檢查${this.urlBase}v1/simulator/machine/${codIm}/${codCS}
以及您的api是否正確處理了此鏈接。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.