我需要修补3级深度的值。我正在看这个答案= patch Value in a nested form control using angular2,但只有你深2级才有效。
我的表单构造如下:
this.myForm = this.fb.group({
Id: [null],
Languages: {
en-GB:{
"Title": "blah"
}
}
});
如何修改标题值?
我试过这个,但它不起作用:
this.myForm.controls['Languages']['en-GB']['Title'].patchValue("other blah");
经过无休止的试验和错误,这是正确的答案:
this.myForm.controls['Languages']['controls']['en-GB']['controls']['Title'].patchValue("other blah");