This post shows you how to solve "Template parse errors: 'mat-form-field' is not a known element" in angular 7 when using the angular material.
Error throwing from your browser.
Uncaught Error: Template parse errors:
'mat-form-field' is not a known element:
1. If 'mat-form-field' is an Angular component, then verify that it is part of this module.
2. If 'mat-form-field' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
You need to import MatFormFieldModule to your @NgModule
@NgModule({
declarations: [
AppComponent,
...
],
imports: [
MatFormFieldModule
...
]
...
})
export class AppModule { }
Next, try to add import CUSTOM_ELEMENTS_SCHEMA
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
then inject into @NgModule
@NgModule({
...
schemas: [CUSTOM_ELEMENTS_SCHEMA]
});
I hope so you can solve the problem 'mat-form-field' is not a known element in angular using angular material.