链HTTP调用

时间:2017-01-09 19:54:18

标签: http angular

我有一个REST API,它返回一个约会数组。对于此数组中的每个项目,我想对另一个API进行一次调用,以获取该项目的更多信息。

   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());

0 个答案:

没有答案