ho il seguente codice per effettuare una richiesta GET elettorale a AngularJS 2:Fare richiesta di polling in angolare 2 utilizzando Osservabile
makeHtpGetRequest(){
let url ="http://bento/supervisor/info";
return Observable.interval(2000)
.map(res => res.json()) //Error here
.switchMap(() => this.http.get(url));
/*
This portion works well
return this.http.get(url)
.map(res =>res.json());*/
}
dattiloscritto mi sta dando un errore rendere la risposta in formato JSON (check commentare nel codice.
TypeError: res.json is not a function
Sorprendentemente, si stava lavorando da tempo e non sono sicuro se ho cambiato niente altro, ma ha smesso di funzionare.
la parte commentato nel lavoro di codice s molto bene.
Ho provato questo. Mi dà ancora l'errore. Tuttavia, fa il sondaggio in ogni caso. – user3288346
Funziona in chrome ma non in IE11 – Developer