angular at-form-field must contain a MatFormFieldControl. code example

Example 1: mat-form-field must contain a MatFormFieldControl

@NgModule({
    imports: [
        MatInputModule
    ],
    exports: [
        MatInputModule
    ]
})

Example 2: mat-form-field must contain a matformfieldcontrol checkbox

The following Angular Material components are designed to work inside a <mat-form-field>:

<input matNativeControl> & <textarea matNativeControl> (version 7 & newer)
<select matNativeControl> (version 7 & newer)
<input matInput> & <textarea matInput> (version 5 & 6)
<mat-select>
<mat-chip-list>

Tags:

Misc Example