要解决Angular mat-form-field找不到"ngForm"的问题,可以按照以下步骤进行操作:
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
@NgModule({
imports: [
FormsModule,
ReactiveFormsModule
],
})
export class AppModule { }
import { FormControl, Validators } from '@angular/forms';
myControl = new FormControl('', Validators.required);
通过执行以上步骤,您应该能够解决Angular mat-form-field找不到"ngForm"的问题。