首页 > 解决方案 > 我无法在视图中获取 id

问题描述

我们有两个具有关系的“需求”和“企业”类OneToMany。我想展示每一个需求者的企业。

API 有效,但问题出在前面。

企业服务:

getDemandeEntreprisebyId(id)
  {
    this.http.get(this.rootURL + '/Entreprise/EntrepriseByDemande/'+id)
    .toPromise()
    .then(res => this.listDemandeEntreprise = res as Entreprise[]);
  }

看法 :

<tr *ngFor="let sd of serviceDemande.list" >
  <td (click)="populateForm(pd)">{{pd.dateDemande | date : 'dd/MM/yyyy'}}</td>
  <td (click)="populateForm(pd)">{{pd.typeDemande}}</td>                                                                                                                                                                                                                                                                                                                                                                                                                                          
  <td  *ngFor="let e of serviceEntreprise.getDemandeEntreprisebyId(sd.idDemande)">{{e.nomEntreprise}}</td>
</tr>

标签: angulartypescript

解决方案


推荐阅读