This is loadSize()
function and it calls a getTotalNumberCampaigns()
function in my campaignsService
class.
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 start up the backend api everything works fine, now I stop the api and refresh my page. It will fire the console.log(err.status);
console.log(err); since it's connection failed. but I actually got 200 status while in my browser console it says it is a 502 error.
anyone tell me why?