嵌套控件的修补值为3级深度

问题描述 投票:0回答:1

我需要修补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");
angular
1个回答
0
投票

经过无休止的试验和错误,这是正确的答案:

this.myForm.controls['Languages']['controls']['en-GB']['controls']['Title'].patchValue("other blah");
© www.soinside.com 2019 - 2024. All rights reserved.