When dynamically creating a component, which object is responsible for providing the factory to create an instance of the component?

  • ComponentFactoryResolver
  • ElementRef
  • NgModule
  • ViewChild
The ComponentFactoryResolver is responsible for providing the factory to create an instance of a component dynamically in Angular. It's a crucial part of dynamic component creation, allowing you to create components on the fly based on specific conditions or requirements in your application. NgModule deals with module-level configuration, ViewChild is used for querying child components, and ElementRef is used for accessing the DOM element of a component, but none of these directly provide a factory for dynamic component creation.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *