我對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