I'm using the subscribe()
to get values in json
format. This values are displayed in screen.
The problem is in Microsoft Edge this method not works. It's returned error of HttpResponse
0. However, in Chrome and Firefox works normally.
This is my code:
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= [];
}
);
}
So, I need use other method than .subscribe()
? What?
So, what is the best way to turn my code works on Microsoft Edge?
---------- UPDATE 1 -----------
This code is my getAsks
. It's a route that return a json file with some data.
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'
})
});
}