如何解决这个 ExpressionChangedAfterItHasBeenCheckedError 错误?

问题描述

我在 mongoDB 中有一个名为 Patient 的文档,其中包含一个名为 Dossier 的数组。 我使用 Select 选项从 Patient 获取特定字段。当我选择时,他们会在其他选择选项中显示档案列表。它工作正常,但试图将特定字段放入数组档案(包含在患者文档中),它们显示错误 enter image description here

PopUpEventComponent.ts :

      objetSelection : any;
     selectedLevel : any;
retrievePatients() {
  let resp = this.patientService.getAllPatients();
  resp.subscribe(
    response => {
      this.tab_Patient = response;
      this.selectedLevel = response[0];
    },error => {
      console.log(error);
    });
}

PopUpEventComponent.html

  <mat-grid-tile class="matg1"[colspan]="2" [rowspan]="2" >
    <div class="modal" style="font-size: 13px">
      
 
    <mat-form-field class="class1">
      <mat-label>Patient</mat-label >
      <select matNativeControl required formControlName="patientname" [(ngModel)]="selectedLevel">
        <option matInput *ngFor="let item of tab_Patient" [ngValue]="item" > {{item.civilite}} {{item.nom}} {{item.prenom}}</option>
      </select>
    </mat-form-field> 

    <mat-form-field class="class8">
      <mat-label>N° Dossier</mat-label>
      <select  matNativeControl formControlName="listdossier" [(ngModel)]="objetSelection">
        <option matInput *ngFor="let item of this.selectedLevel?.dossiers"  [ngValue]="item">
          {{item?.numDossier}}  
        </option>
      </select>
    </mat-form-field> 

    <mat-form-field class="class5">
      <mat-label>Montant globale</mat-label>
      <input matInput type="number" placeholder="Montant globale*" formControlName="montantg" readonly> {{objetSelection.montantGlobale}}
      <mat-icon class="maticon" matSuffix>attach_money</mat-icon>
    </mat-form-field>

  </mat-grid-tile>
  </mat-grid-list>

请问有什么答案吗??

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)