0

How do I create a component from a variable name in Angular similar to what can be achieved in Vue using Dynamic Components:

<component :is="myTemplate.type"></component>
Kuba Szymanowski
  • 1,199
  • 10
  • 24

1 Answers1

1

Before Ivy: You should use the ComponentFactoryResolver. You can check out a good example of it here: link

With Angular Ivy
You can use the renderComponent function. You can check out my blog about Ivy and dynamic component rendering here: link

Eliran Eliassy
  • 1,492
  • 10
  • 24