This is a function loadSize(), and it calls a function getTotalNumberCampaigns()in my class campaignsService.
loadSize() {
this.campaignsService.getTotalNumberCampaigns().subscribe(value => {//async call
this.campaignSize = value;
}, (err: any) => { console.log(err.status); console.log(err);}
);
}
this is my getTotalNumberCampaigns ()
getTotalNumberCampaigns(): Observable<number> {
return this.http.get(`${this.apiUrl}/Count`, { headers: this.headers })
.map<any>(res => res.json())
}
I run the backend api, everything works fine, now I stop the api and refresh my page. It will run console.log(err.status);console.log (err); because the connection failed. but in fact I have a status of 200, while my browser console says it is a 502 error.
will someone tell me why?

source
share