I currently am getting an array (in the code below resourceTypes) and with an ngSwitch. As you can see depending on the TypeName I create a different kind of component/directive (config-resource-editor or mvc-resource-editor or ...). However I don t like this code since when I create more resource editors I always have to modify this code etc. How can I refactor the code so I can just create the correct resource-editor depending on the type, without ng-switch. I looked at ng-content, I think I have to do something with it but I fail to see it.
TL;DR: How can I refactor the code below so I don t have to use ngSwitch anymore but 'couple' the type to a component.
<div *ngFor="let aType of resourceTypes; let i = index" role="tabpanel" class="tab-pane" [ngClass]="{'active': i==0}" [attr.id]="aType.Name">
<span *ngSwitch="aType.Name">
{{aType.Name}} tab content here
<config-resource-editor [application]="application" ngSwitchWhen="Config" template></config-resource-editor>
<mvc-resource-editor [application]="application" ngSwitchWhen="MVC" template></mvc-resource-editor>
<other-resource-editor [application]="application" ngSwitchWhen="Other" template></other-resource-editor>
<wcf-resource-editor [application]="application" ngSwitchWhen="WCF" template></wcf-resource-editor>
<web-resource-editor [application]="application" ngSwitchWhen="Web" template></web-resource-editor>
<webapi-resource-editor [application]="application" ngSwitchWhen="WebAPI" template></webapi-resource-editor>
</span>
</div>