我试图在我的 ng2-smart-table 中使用自定义渲染器组件,但出现以下错误。
No component factory found for undefined. Did you add it to @NgModule.entryComponents?
at…, …}
奇怪的是组件说它未定义。
我的组件看起来像这样。
import { Component, OnInit, Input } from '@angular/core';
import { ChannelTableModeService } from '../../../../../../services/channel-table-mode.service';
import { ViewCell } from 'ng2-smart-table';
@Component({
selector: 'app-channel-attribute-renderer',
template: '{{renderValue}} --'
})
export class ChannelAttributeRendererComponent implements OnInit {
constructor() { }
renderValue: string;
@Input() value: string | number;
@Input() rowData: any;
ngOnInit() {
this.renderValue = '<' + this.value + '>';
}
}
我还确保该组件在模块中。
@NgModule({
imports: [
Ng2SmartTableModule,
CommonModule,
ChannelProfileRoutingModule,
VeexCommonModule,
TranslateModule,
FormsModule
],
entryComponents: [ChannelAttributeRendererComponent, PasswordRenderComponent],
providers: [ChannelTableModeService],
declarations: [ PasswordRenderComponent, ChannelProfileComponent, ChannelTableComponent, ServiceTypeComponent, ServiceGroupComponent, ChannelPlanEditorComponent, ChannelAttributeRendererComponent]
})
export class ChannelProfileModule { }
有没有人看到这个问题。为什么他工厂认为组件未定义。
我的智能表的配置形式如下:
this.settings = {
columns: {
'Channel': {title: 'Channel'},
'Channel Label': {title: 'Channel Name'},
'Video': {title: 'Video', type: 'custom', renderComponent:
PasswordRenderComponent}
}}