Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export class UiTableCellComponent implements OnInit, AfterContentChecked {
- @Input() dataRow: any;
- @Input() columnDef: UitableColumn;
- @ViewChild(UitablecompHostDirective) mgmtUitablecompHost: UitablecompHostDirective;
- constructor(private componentFactoryResolver: ComponentFactoryResolver) {
- }
- ngOnInit() {
- }
- ngAfterContentChecked(): void {
- if (this.columnDef.cellDataComponent) {
- this.loadComponent();
- }
- }
- loadComponent() {
- const componentFactory =
- this.componentFactoryResolver.resolveComponentFactory(this.columnDef.cellDataComponent);
- const viewContainerRef = this.mgmtUitablecompHost.viewContainerRef;
- viewContainerRef.clear();
- const componentRef = viewContainerRef.createComponent(componentFactory);
- (<UitableComponent>componentRef.instance).data = this.dataRow;
- }
Add Comment
Please, Sign In to add comment