我想在表单上添加一个反应式表单控件并触发错误:
多个自定义值访问器匹配具有未指定名称属性的表单控件
一切都分开工作,反应式表单验证,掩码或matDatepicker,任何一对组合也可以工作,但三者一起提示错误。
这是我的代码:
在组件.ts
formGroup = new FormGroup({
date: new FormControl()
});
在 component.html 中
<mat-form-field>
<input type="text" matInput [matDatepicker]="date_picker" mask="d0/M0/0000" formControlName="date">
<mat-datepicker-toggle matSuffix [for]="date_picker"></mat-datepicker-toggle>
<mat-datepicker #date_picker></mat-datepicker>
</mat-form-field>
我正在使用:
"@angular/cli": "8.3.19"
"ngx-mask": "8.1.7"
"@angular/material": "8.2.3"