AshKeys

Confessions and Confusions of Ashok M A. Personal and Professional Blog.

Ashok Mannolu Arunachalam, FixErrorAngularMaterialMatFormFieldControl
Back

Fix for Error : mat-form-field must contain a MatFormFieldControl

I had this issue. I imported MatFormFieldModule at my material module, but forgot to add MatInputModule to the imports array:

ts
import {
MatFormFieldModule,
MatInputModule
} from '@angular/material'
@NgModule({
imports: [MatFormFieldModule, MatInputModule]
})
export class MaterialModule {}

Always keep a separate module that contains all the material things you use.