我对Observables,Promises,Angular 2和Javascript相当陌生。将params传递给映射的observable
我的问题是我怎么到“项”对象的引用在这里:
getItemTransactions (item: Item): Observable<any> {
// Do some stuff ...
return this.http.post(this.url, body, options)
.map(this.extractData)
.catch(this.handleError);
}
在映射ExtractData由助手?
private extractData(res: Response) {
let json = res.json().body
/// How do I assign back to item object here?
item.some_property = json["some_property"]
}
代码来自这里: https://angular.io/docs/ts/latest/guide/server-communication.html#!#extract-data