补丁值反应形式阵列数角度2

时间:2017-10-10 13:46:34

标签: angular-reactive-forms

{
 "id": "1",
 "name": ""
 "parts": [
   {
    "name": "partname1",
    "description": "description 1"
    "messages": [
      {
       "text": "text 1"
       "sender": "sender 1"
      }
    ]
  },
  {
   "name": "partname2",
   "description": "description 1"
   "messages": [
     {
      "text": "text 2"
      "sender": "sender 2"
     }
   ]
  }
 ]
}

基于此:https://angular.io/guide/reactive-forms 使用此代码:

setParts(parts) {
  const partsFormGroup= parts.map(part => this.fb.group(part));
  const partsFormArray = this.fb.array(partsFormGroup);
  this.myForm.setControl('parts', partsFormArray);
}

patchValue适用于零件属性:name&描述

如何patchValue消息?

我收到此错误:

ERROR TypeError: this.validator is not a function

0 个答案:

没有答案