我正在尝试使用 ag-grid 渲染组件,但出现此错误:
core.js:15713 ERROR 错误:没有为 squareRenderer 找到组件工厂。你把它添加到@NgModule.entryComponents 了吗?在 noComponentFactoryError (core.js:9875)
表.模块.ts
@NgModule({
declarations: [SquareRenderer, ...containers, ...components],
imports: [
...
AgGridModule.withComponents([SquareRenderer]),
...
],
entryComponents: [SquareRenderer],
exports: [],
providers: []
})
export class TableModule {}
表组件.ts
columnDefs = [
{
headerName: '',
children: [
{
headerName: 'Farm/Field',
field: 'farm',
width: 183,
lockPosition: true,
cellRendererFramework: 'squareRenderer'
},
...
]
frameworkComponents = {
squareRenderer: SquareRenderer
};
}
HTML
<ag-grid-angular
#agGrid
style="width: 100%; height: 100%"
class="ag-theme-balham"
[columnDefs]="columnDefs"
[defaultColDef]="defaultColDef"
(gridReady)="onGridReady($event)"
[cacheBlockSize]="cacheBlockSize"
[infiniteInitialRowCount]="infiniteInitialRowCount"
[rowModelType]="'infinite'"
[maxBlocksInCache]="maxBlocksInCache"
[frameworkComponents]="frameworkComponents"
>
</ag-grid-angular>
为什么我会收到此消息?我究竟做错了什么?