I have a backend API, which as shown in this POSTMAN screenshot is working. 
Here is my service:
getComments(line: string, department: string, startTime?: number, endTime?: number): Observable<Array<IComments>> {
let headers = new Headers(
{
'Content-Type': 'application/x-www-form-urlencoded',
'line': line,
'cell': department,
'start': new Date(),
'end': ago(24, "hours")
});
let options = new RequestOptions({ headers: headers });
return this.http.get('api/data/comments', options)
.map(this.extractData)
.catch(this.handleError);
}
private extractData(res: Response) {
let body = res.json();
return body.data || {};
}
and this is what my component contains:
this.dataService.getComments('604', 'powders').forEach(result => {
console.log('Res: ' + JSON.stringify(result));
that.comments = result;
});
However, all I get in the console is:
Res: {}
Why is the data not being returned, as it is in postman?
Update:
and if I console.log(body) in extractData, then I get:
Object {result: "COMMENTS604"}
console.loginextractData?new Date()instead of the string'080988'for your start header. And you're sending something unknown instead of'178798798'for the end header. The screen shot shows that you receive a JSON object as result, and your service returns an Observable, but you're calling forEach() on this observable as if it was an array, instead of subscribing to it. WHat you're doing in extractData doesn't make sense either, given that there is no data in the returned JSON.