我想在反应式表单中使用不带input的日历组件。 我找到了组件mat-calendar并尝试这样做: <mat-calendar formControlName="appointment"></mat-calendar> 相应的TypeScript文件具有以下内容: this.form = this.formBuilder.group({ appointment: [''] }); 但是显示了一个错误: ERROR Error: No value accessor for form control with name: 'app
在我的sing-up组件中,我创建了一个用于验证输入字段的表单组。 this.UserForm = new FormGroup({
name: new FormControl('', Validators.required),
surname: new FormControl('', Validators.required),
username: new FormControl('', Validators.compose([
Validators.required,
Validators.pattern('
我的输入是这样的:
<mat-form-field *ngFor="let d of data">
<mat-label>Item</mat-label>
<input [(ngModel)]="d.item" matInput required>
</mat-form-field>`
我已经尝试过了:
<form #inputForm="ngForm">
<mat-form-field *ngFor="let d of dat
我想编写一个组件,用于包装Material Date Picker实现,以简化在整个应用程序中使用date组件。我曾经让它工作过,但是混合了模板驱动和响应式表单代码,这从来都不是一个好主意,现在给出了它被弃用的警告。因此,我尝试仅使用ngModel重写。但是,我无法让验证在初始加载时正常工作。它总是给出一个必填字段错误。
HTML
<mat-form-field style="width:inherit">
<input id="DatePickerControlInput" name="datePickerControlInp