Aug 27, 2017 · 1 min read
I’d probably do something like that:
// Else it’s a component
const factory = this.resolver.resolveComponentFactory(this.content);
const componentRef = factory.create(this.injector);// Add this as new Input
if(this.inputs) {
Object.keys(this.inputs).forEach(input => {
componentRef.instance[input] = this.inputs[input];
});
componentRef.changeDetectorRef.detectChanges();
return [ [ componentRef.location.nativeElement ] ];
But I would avoid it and just pass a smart component that renders dumb components and handle their state with a Service/Store.
