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:

1
2
3
4
5
6
import { MatFormFieldModule, MatInputModule } from '@angular/material';

@NgModule({
imports: [MatFormFieldModule, MatInputModule],
})
export class MaterialModule {}

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