Skip to content

Instantly share code, notes, and snippets.

@petyosi
Created February 9, 2018 15:05
Show Gist options
  • Save petyosi/44fef6e1415cade0834adb32c4dba7db to your computer and use it in GitHub Desktop.
Save petyosi/44fef6e1415cade0834adb32c4dba7db to your computer and use it in GitHub Desktop.
@Component({
selector: 'grid-cell',
template: ''
})
export class Cell implements OnInit {
@Input() componentType: any;
constructor(private viewContainerRef: ViewContainerRef,
private cfr: ComponentFactoryResolver) {
}
ngOnInit() {
let compFactory = this.cfr.resolveComponentFactory(this.componentType);
this.viewContainerRef.createComponent(compFactory);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment