我需要调用一个包含大量记录的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;
}));
}