I have a component that should accept arbitrary amount of child components of known type and render them with additional wrapper in an *ngFor
. Alternatively, can I pass and render a list of <ng-template>
?
Container will be used like this:
<app-custom-container>
<app-custom-child name="1">...</app-custom-child>
<app-custom-child name="2">...</app-custom-child>
<app-custom-child name="3">...</app-custom-child>
</app-custom-container>
Inside container template I'd like to do something like this:
template: '<div>
<ng-container *ngFor="let child of ...?">
<app-custom-child-internal-wrapper [id]="child.id">
<ng-content/> <!--somehow only render this specific child-->
</app-custom-child-internal-wrapper>
</ng-content>
</div>'
Can this or something similar be done?
Error: NG0201: No provider for TemplateRef
– Lao