mat-form-field must contain a MatFormFieldControl

前端 未结 30 1536
萌比男神i
萌比男神i 2020-11-28 04:35

We are trying to build our own form-field-Components at our Company. We are trying to wrap material design\'s Components like this:

field:



        
30条回答
  •  有刺的猬
    2020-11-28 05:04

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

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

    More info here.

提交回复
热议问题