【问题标题】:Error: No component factory found for 'component'. Did you add it to @NgModule.entryComponents?错误:找不到“组件”的组件工厂。你把它添加到@NgModule.entryComponents 了吗?
【发布时间】:2019-09-17 11:02:13
【问题描述】:

我收到以下错误:

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

我知道我应该将组件(DropdownComponent)添加到EntryComponents

entryComponents: [
    DropdownComponent    
  ],

我将此添加到 app.module.ts 但我仍然收到相同的错误。

我创建了一个Stackblitz。 如果您打开控制台并双击其中一个网格单元,您将看到错误

【问题讨论】:

    标签: angular typescript ag-grid


    【解决方案1】:

    如果您已经在app.modules.ts中添加了,那么您还需要在您要显示的组件的entryComponents中添加DropdownComponent。如下:

    @Component({
      selector: 'abc',
      templateUrl: './abc.component.html',
      styleUrls: ['./abc.component.scss'],
      entryComponents: [DropdownComponent]
    })
    

    希望对你有帮助。

    【讨论】:

    • then you also need to add the DropdownComponent in the component's entryComponents,这种方法背后的原因是什么..?你能解释一下吗..
    • 在 column-data.ts 中,我添加了 `cellEditor: 'editComp' ` 并在 af-planning-grid.component.ts 中(将使用该组件)` frameworkComponents: { editComp:下拉组件 }, `
    猜你喜欢
    • 2018-05-06
    • 2018-01-06
    • 1970-01-01
    • 1970-01-01
    • 2019-11-05
    • 2019-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多