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'];
});
}
更改时如何更新DOMmainshoppinglistitems
解决方案
推荐阅读
- spring-boot - 无法在 java 中使用 DocumentClient 从 cosmos 中删除文档
- c# - 如何显示一个消息框,询问用户是否真的要退出 cmd 窗口?
- android - 导航组件问题和 TextInputLayout 错误
- google-cloud-data-fusion - 无法将 Excel 文件从 Google Cloud Storage 加载到 Google Data Fusion
- sqlite - 使用子表从父表中获取值
- python - 根据 Firestore 更改触发 Cloud Function
- angular - 为什么 Stripe 付款请求按钮会出现错误?
- javascript - TypeScript 中泛型的行为
- googlevis - 使用 options=list(vAxes="[{title:'val1'}, {title:'val2'}]") 时没有出现轴的 gvisSankey 标题
- android - Android动画同时翻译和缩放不是我想要的