As I work on creating a component that accepts another component as an input, I encountered a situation where I needed to define the input type correctly. You can check out a demo of this in action here on StackBlitz. In the @Input()
section of the ParentComponent
, you'll notice it's declared as:
@Input() ComponentToEmbed : eComponentType<Component>;
While researching, I stumbled upon a question on StackOverflow from several years ago suggesting the use of ComponentType<T>
. Despite my efforts in trying this, I couldn't find ComponentType
available in Angular 13. When consulting the documentation, there was no mention of ComponentType<T>
. Can anyone guide me on how to properly type the @Input()
?