I know that in order to create a component dynamically you can do something like this
let componentFactory = this.componentFactoryResolver.resolveComponentFactory(component);
let viewContainerRef = this.host.viewContainerRef;
viewContainerRef.clear();
let componentRef = viewContainerRef.createComponent(componentFactory);
componentref.instance.data = someData;
ngOnInit is called right after viewContainerRef.createComponent(), which is before the data property is patched through to the component. In my ngOnInit I have logic that needs all properties in advance. How can I pass my props to the component before it is created?
ngOnInitas would be the case with a statically added component (and is what I'm interested in).ngOnInitI want to map it in some way and use it in various parts of the component.