找不到 'CreatePrefixComponent' 的组件工厂

No component factory found for 'CreatePrefixComponent'

我添加了一个子组件 (CreatePrefixComponent),用于在单击按钮时显示弹出模式。我收到以下错误:

Error: No component factory found for CreatePrefixComponent. Did you add it to @NgModule.entryComponents?

但是我在子组件的模块中添加了CreatePrefixComponent,像这样:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MaterialModule } from '../../material.module';
import { PrefixComponent } from './prefix.component';
import { RouterModule } from '@angular/router';
import { prefixRoutes } from './prefix.routing';
import { CreatePrefixComponent } from './create-prefix/create-prefix.component';
import { MatPaginatorModule, MatTableModule } from '@angular/material';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { FlexLayoutModule } from '@angular/flex-layout';

@NgModule({
  imports: [
    CommonModule,
    MaterialModule,
    RouterModule.forChild(prefixRoutes),
    MatTableModule,
    MatPaginatorModule,
    FormsModule,
    ReactiveFormsModule,
    FlexLayoutModule,
  ],
  declarations: [PrefixComponent, CreatePrefixComponent],
  entryComponents: [CreatePrefixComponent]
})
export class PrefixModule { }

我在项目中使用了angular material

有人能给我指出正确的方向吗?我错过了什么吗?

添加 MatDialogModule 并检查一次..