I have array of components stored in main component. They are of different types. I used ngFor and ngSwitch directives to display them all.
<div *ngFor="let component of components"
[ngSwitch]="component.id">
<component-a *ngSwitchCase="1"></component-a>
<component-b *ngSwitchCase="2"></component-b>
<component-c *ngSwitchCase="3"></component-c>
</div>
This approach is quite problematic when I add new type, e.g. ComponentX, beacuse I have to add another ngSwitch case. Is there any possibility to make it more generic?