我有:
this.editMemberForm = this.formBuilder.group({
name: [{value: '', disabled: true}],
id: [{value: '', disabled: true}],
relType: ''
});
然后我将值设置为禁用的表单控件:
this.editMemberForm.patchValue({
name: 'Me',
id: '000',
});
在onSubmit()
:
console.log('Saving data', this.editMemberForm.value);
// { relType: '123' }
我需要this.editMemberForm.value
为{ name: "Me", id: '000', relType: "123" }
。