小编tsh*_*kus的帖子

角垫分隔器不是已知元素

我正在尝试以 angular 测试弹出组件,但我不知道为什么在启动测试时出现错误:

'mat-divider' 不是已知元素: 1. 如果 'mat-divider' 是 Angular 组件,则验证它是否是该模块的一部分。2. 如果'mat-divider' 是一个Web 组件,则将'CUSTOM_ELEMENTS_SCHEMA' 添加到该组件的'@NgModule.schemas' 以抑制此消息。

我在@NgModule 中导入了它,这是我的代码:

@NgModule({
  declarations: [
    AppComponent,
    AdminTopMenuComponent,
    SvGameCardComponent,
    SvCreationPopupComponent,
    MockPopupComponent,
	MyDialogComponent,
	FvCreationPopupComponent,
    GameModesComponent,
    LinkTestComponent,
    UserComponent,
  ],
  imports: [
    BrowserModule,
    HttpClientModule,
    AppRoutingModule,
    FormsModule,
    ReactiveFormsModule,
    MatDialogModule,
	BrowserAnimationsModule,
	MatButtonModule,
	MatCheckboxModule,
    MatTableModule,
    MatDividerModule,
    MatInputModule,
    MatSelectModule,
    MatFormFieldModule,
    MatCardModule,
    AppRoutingModule,
    RouterModule,
  ],
  exports: [
      MatDividerModule,
      MatFormFieldModule,
  ],
  providers: [BasicService],
  bootstrap: [AppComponent],
  entryComponents: [
    MyDialogComponent,
    SvCreationPopupComponent,
    FvCreationPopupComponent,
    ]
})

export class AppModule {

}
Run Code Online (Sandbox Code Playgroud)

@Component({
  selector: 'app-fv-creation-popup',
  templateUrl: './fv-creation-popup.component.html',
  styleUrls: ['./fv-creation-popup.component.css'] …
Run Code Online (Sandbox Code Playgroud)

testing typescript angular

3
推荐指数
1
解决办法
9571
查看次数

标签 统计

angular ×1

testing ×1

typescript ×1