To dynamically create a component and attach it to a specific location in the view, you'd use the ______ along with ComponentFactoryResolver.

  • ComponentLoader
  • DynamicInjector
  • ViewChild
  • ViewContainerRef
To dynamically create and attach components in Angular, you use the ViewContainerRef along with ComponentFactoryResolver. ViewContainerRef provides access to the view where you want to insert the component, and ComponentFactoryResolver helps create and manage the component instance. ViewChild is a decorator used to access child components, but it's not directly related to creating components dynamically. ComponentLoader and DynamicInjector are not standard Angular concepts in this context.
Add your answer
Loading...

Leave a comment

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