node.js - 更新 NgFor 表中的行
问题描述
我正在显示来自服务器的数据,在 ngFor 循环中,在表内,我希望能够随时更改或更新值,而不是在每一行旁边都有按钮,
或者无论如何切换按钮编辑以启用仅编辑一行?
例如这里
<table>
<tr *ngFor="let car of cars ;index as i ">
<td>
<input type="text" name="color" [(ngModel)]="model.color" #color="ngModel" >
</td>
<td>{{ car.brand }}</td>
<td>{{ car.id }}</td>
</tr>
</table>
当我这样做时,我只需点击表格下方的按钮
<button type="button" (click)="onUpdateCar()"> update </button>
解决方案
推荐阅读
- android - Android Espresso 在自定义视图类中找不到 Edittext
- c# - 如何制作连接输出?
- c# - MongoDB 将对象推入数组
- apache-spark - Spark 读取 parquet 文件(56MB),得到一个包含两个或多个分区的 df
- python - 如何将应用程序(flask-python + redis)泊坞窗推送到 gcr.io 并将应用程序部署到谷歌 kubernetes
- flutter - 为什么在 Dart 中实现 Flutter?
- c# - System.Type.GetTypeFromProgID(VisualStudioProgId) return null
- r - 在同一个变异函数 dplyr 中使用滞后结果
- r - 对组进行循环并将循环结果存储在 R 中的表中
- javascript - 如何使用 jwt 在 typescript 中实现更改密码 API?