[英]reactive forms angular form group
Why I can't write into the input before the set value?为什么我不能在设定值之前写入输入?
html html
<form action="" [formGroup]="titleForm">
<input class="note-title" type="text" formControlName="title">
</form>
typescript typescript
titleForm : FormGroup = new FormGroup(
{'title':new FormControl}
);
this.titleForm.patchValue({
title:"hello"
});
}
the input value is successfully changed but I can't write into the input输入值已成功更改,但我无法写入输入
rewrite formGroup to this将 formGroup 重写为此
titleForm : FormGroup = new FormGroup({
title: new FormControl('')
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.