Quick Answer
ViewContainerRef.createComponent() dynamically creates a component and inserts it into the DOM at the view container's location. Returns a ComponentRef with the component instance and host view. The created component is added to the host module's CD tree. Destroy with ComponentRef.destroy(). Used for: dynamic dialogs, tooltips, dynamic form fields. More powerful than *ngIf for programmatic creation.
Answer
Angular creates a host view, initializes metadata, sets bindings, and renders template instructions.
S
SugharaIQ Editorial Team
Verified Answer
This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.