I have the following code to make a polling GET request in AngularJS 2:
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());*/
}
TypeScript is giving me an error make the response in JSON format (check comment in the code.
TypeError: res.json is not a function
Surprisingly, it was working for some time and I am not sure if I changed anything else, but it stopped working.
The commented part in the code works very well.