角材料“垫标签”不是已知元素

时间:2020-06-13 12:39:23

标签: angular angular-material

我正在开发一个简单的角度应用程序,并在通常情况下导入材料表单字段时得到:

src/app/auth/login/login.component.html:8:5 - error NG8001: 'mat-label' is not a known element:
1. If 'mat-label' is an Angular component, then verify that it is part of this module.
2. If 'mat-label' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

     <mat-label>Password</mat-label>

和我的模块:

@NgModule({
  declarations: [RegisterComponent, LoginComponent],
  imports: [
    CommonModule,
    BrowserModule,
    BrowserAnimationsModule,
    ReactiveFormsModule,
    HttpClientModule,
    FormsModule,
    MatFormFieldModule,
    MatInputModule,
    MatButtonModule,
    MatTabsModule,
  ],
  providers: [],
  exports: [],
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
})

我正在使用angular 9.1.9,有什么想法吗? 干杯

1 个答案:

答案 0 :(得分:0)

找到它了,它没有将此模块导入app.module中。