My question is how to print the answer to the console?
You can simply type res:
.subscribe((res:Person) => { this.postResponse = res; console.log(res); });
Click here for a demo panel .
I'm not sure what to sign (...)
Http.post(...) () Observable<Response> ().
POST (a Observable<Response>) .map() (link). , JSON :
.map((res: Response) => res.json())
.map() Observable<Response>. subscribe.
subscribe() (link) Observable (link), , , "" "" , / ( "" ), , - () next, (on) error (on) complete.
, .subscribe() :
.subscribe(
(response) => {
console.log("VALUE RECEIVED: "+response);
},
(err) => {
console.log("ERROR: "+err);
},
() => {
console.log("COMPLETED");
}
);
, Angular2 Http, RxJS Observables. , , ( :).