Error: No value accessor for form control with name: 'xxx'
在Angular的表单开发中,经常会遇到错误 ‘Error: No value accessor for form control with name: 'xxx'’.
一般在自定义表单上加上‘ngDefaultControl’ 即可解决。
例子:
<input ngDefaultControl *ngSwitchCase="'textbox'" [formControlName]="question?.key" [id]="question?.key" [type]="question?.type" [value] = "question?.value" />
版权声明:本文由沐萱草的笔记发布,如需转载请注明出处。