【发布时间】:2021-08-13 16:22:14
【问题描述】:
我正在尝试使用 patchValue 更新 formArray 中的值,但在某些情况下,例如:
表单数组:
0: {id: 12, start_time: "17:11", end_time: "17:41", name: "AUB Medical Center"}
1: {id: 15, start_time: "17:58", end_time: "18:03", name: "Sanayeh"}
我想更改对象 1 中的 start_time。
所以我需要使用这个:this.locationForm.patchValue(newValueOfStartTime);
这里我无法为 patchValue 分配我想要更改的对象的 id 和参数!
有什么建议吗?
【问题讨论】:
-
Angular 有 documentation 说明如何做到这一点。
-
感谢文档。帮了我很多@R.Richards