mat 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
Maybe you need to close <input> tag:
<!-- Wrong -->
<mat-form-field>
<input matInput>
</mat-form-field>
<!-- Right -->
<mat-form-field>
<input matInput />
</mat-form-field>
Example 3: 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>