I have the following code:
var headers = new Headers();
headers.append(‘Content-Type’, ‘application/json’);
this.http.post(
'http://www.syntaxsuccess.com/poc-post/',
JSON.stringify({firstName:'Joe',lastName:'Smith'}),
{headers:headers}
).map(
(res: Response) => res.json()
).subscribe(
(res:Person) => {
this.postResponse = res;
console.log("VALUE RECEIVED: ",res);
},
(x) => {
/* this function is executed when there's an ERROR */
console.log("ERROR: "+x);
},
() => {
/* this function is executed when the observable ends (completes) its stream */
console.log("Completed");
}
);
but I keep getting the error:
_this.http.post(…).map is not a function
. How can I fix this?
Cheers