Is there a way to make this possible in angular?
const arrayOfComponents = ['app-component-1', 'app-component-2', 'app-component-3']
<ng-container *ngFor="let component of arrayOfComponents">
<{{ component }} [data]="data"></{{ component }}>
</ng-container>
instead of:
<app-component-1 [data]="data"></app-component-1>
<app-component-2 [data]="data"></app-component-2>
<app-component-3 [data]="data"></app-component-3>
Because sometime we don't know the name of the component to view and the name is sent programmatically.
In other words I am trying to make a generic component which I send an array of component names/selectors to it and it renders them.