I fount this similar question. angular 4+ assign @Input for ngComponentOutlet dynamically created component
But it has been about a month. Has anything changed?
Basically, I followed this guide and created a dynamic component: https://angular.io/docs/ts/latest/cookbook/dynamic-component-loader.html
With this approach, I can assign a value to the dynamic component:
(<AdComponent>componentRef.instance).data = adItem.data;
Is it still true I can't assign a value to the dynamic component with NgComponentOutlet out of the box? (https://angular.io/docs/ts/latest/api/common/index/NgComponentOutlet-directive.html)
You can pass in a custom injector like this - https://github.com/angular/angular/issues/16373#issuecomment-306544456
This was kind of a hack so we ended up using this library-
https://www.npmjs.com/package/ng-dynamic-component
Worked like a charm!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With