Currently I'm switching from http (@angular/http) to HttpClient (@angular/common/http) and have problems mapping my response to objects.
Old code (was working before)
this.http.get(environment.baseUrl + '/api/timeslots')
.map((response: Response) => {
const data = response.json();
const timeslots = Array.of<Timeslot>();
for (const item of data) {...}
New code, but compilation error:
this.httpClient.get(environment.baseUrl + '/api/timeslots')
.map((response: Response) => {
const data = <Timeslot[]> response;
const timeslots = Array.of<Timeslot>();
for (const item of data) {...}
Do I miss a cast? The response is an array of Timeslots.