触发事件后立即更新选择下拉列表

时间:2018-11-02 12:13:56

标签: angular

我有带下拉列表的选择框。这些数据来自响应,所以我想在更改数据时更新数据。

<mat-select placeholder="Kategorie auswählen" [(ngModel)]="categoryid" (selectionChange)="categorychanged(categoryid)">
     <mat-option *ngFor="let category of mainshoppinglistitems" [value]="category._id">
          {{category.dishType}}
     </mat-option>
 </mat-select>

因此,如果我触发事件并尝试更改响应中的数据。当我单击选择框时,它不会更新。

getUpdateData() {
     this.cartservice.getShoppingListOnly().then(response => {
      this.mainshoppinglistitems = response['data'];
    });
}

更改mainshoppinglistitems时如何更新DOM

0 个答案:

没有答案
相关问题