在angular中调用多个API

我需要调用一个包含大量记录的api1,每个记录都有personId。 我需要在数据表中登记数据。根据personId,我必须从另一个api2中获取personName,并同时显示在同一数据表中。

here is my Service file contains two methods.
  return this.http.get(`${this.api1}`);
}
getcardStatus(id){
  return this.http.get(`${this.api2}/${id}`);
}


in the component ts file i need to implement method which can call both tha apis at same time to get required data.

i tried this but its not working.

listAllDisputes() {
  this.disputeService.getcardStatus().pipe(map( (res) =>{
    this.disputeslist = res;
    const id = this.disputeslist.card_id;
    return this.disputeService.listDisputes()
    }).subscribe( data =>{
      this.disputeslist = data;
    }));
}




draggon 回答:在angular中调用多个API

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3149308.html

大家都在问