Answer the question
In order to leave comments, you need to log in
How to build component template recursively?
I have an app-document-form-node component that receives a tree model and renders nested components.
<app-document-form-node [parent] = "block" [block] = "tree"> </app-document-form-node>
<ng-container * ngIf = "block.tag === 'ADRESATS'">
<app-adresat-list [parent] = "block" [adresats] = "block.children"> </app-adresat-list>
</ng-containe>
<ng-container *ngFor="let block of adresats">
<div class="document-block">
<div class="document-block__title">
{{ block.title }}
</div>
<div class="document-block__body">
<ng-container *ngFor="let bl of block.children">
<app-document-form-node [parent]="parent" [block]="bl"></app-document-form-node>
</ng-container>
</div>
</div>
</ng-container>
<div class = "document-block">
already present in the app-document-form-node . <ng-container *ngIf="block.tag === 'ADRESATS'">
<app-adresat-list [parent]="block">
<ng-container *ngFor="let adresat_block of block?.children">
<ng-container *ngFor="let bl of adresat_block.children">
<app-adresat [block]="bl">
<app-document-form-node [parent]="adresat_block.children" [block]="bl"></app-document-form-node>
</app-adresat>
</ng-container>
</ng-container>
</app-adresat-list>
</ng-container>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question