链HTTP调用
我有一个RESTAPI,它返回一个约会数组。对于这个数组中的每个项,我想对另一个API进行一次调用,以获取该项的更多信息链HTTP调用,http,angular,Http,Angular,我有一个RESTAPI,它返回一个约会数组。对于这个数组中的每个项,我想对另一个API进行一次调用,以获取该项的更多信息 this.httpClient.get(this.serverUrl, this.httpOptions.RequestOptions) .map(res => res.json()) .map((items: Array<any>) => { let list: Array<Mett
this.httpClient.get(this.serverUrl, this.httpOptions.RequestOptions)
.map(res => res.json())
.map((items: Array<any>) => {
let list: Array<MettAppointmentModel> = [];
if (items) {
items.forEach(item => {
let model = new MettAppointmentModel();
model.Created = item.created;
model.CreatedBy = item.createdBy;
model.Date = item.date;
model.Id = item._id;
model.participated = this.httpClient.get(this.serverUrl + model.Id, this.httpOptions).map(response => return response.json());
list.push(model);
});
}
return list;
} );
model.participated = this.httpClient.get(this.serverUrl + model.Id, this.httpOptions).map(response => return response.json());