2017-09-14 6 views
2

J'essaie d'utiliser un composant Renderer personnalisé dans ma table ng2-smart mais j'obtiens l'erreur suivante.Composant Render personnalisé Ng2-smart-table

No component factory found for undefined. Did you add it to @NgModule.entryComponents? 
    at…, …} 

Whats Strange est que le composant dit son indéfini.

Mon composant ressemble à ceci.

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 + '>'; 
    } 

} 

J'ai également vérifié que le composant se trouvait dans le module.

@NgModule({ 
     imports: [ 
     Ng2SmartTableModule, 
     CommonModule, 
     ChannelProfileRoutingModule,  
     VeexCommonModule, 
     TranslateModule, 
     FormsModule 
     ], 
     entryComponents: [ChannelAttributeRendererComponent, PasswordRenderComponent], 
     providers: [ChannelTableModeService], 
     declarations: [ PasswordRenderComponent, ChannelProfileComponent, ChannelTableComponent, ServiceTypeComponent, ServiceGroupComponent, ChannelPlanEditorComponent, ChannelAttributeRendererComponent] 
    }) 

export class ChannelProfileModule { } 

Tout le monde voit le problème. Pourquoi l'usine pense-t-elle que le composant n'est pas défini?

La configuration forment ma table intelligente ressemble à ceci:

this.settings = { 
columns: { 
    'Channel': {title: 'Channel'}, 
    'Channel Label': {title: 'Channel Name'}, 
    'Video': {title: 'Video', type: 'custom', renderComponent: 
PasswordRenderComponent} 
}} 

Répondre

2

Essayez d'obtenir le code de distribution de NG2-smart table de github et remplacer votre code de table ng-smart existant dans le répertoire des node_modules. J'ai aussi eu un problème similaire, je l'ai réparé en remplaçant le module ng-smart-table de la distribution