[Solved] Repeated elements with dynamic datas code optimize in angular7


I got a solution for that

<ul>
    <li *ngFor="let link of links">
        <ng-container 
             *ngTemplateOutlet="simpleLink; context:{link:link}">
        </ng-container>
    </li>
</ul>

<ng-template #simpleLink let-link='link'>
    Simple : {{ link.name }}
    <ul>
        <li *ngFor="let link of link.childLinks">
            <ng-container 
                *ngTemplateOutlet="simpleLink; context:{link:link}">
            </ng-container>
        </li>
    </ul>
</ng-template>

solved Repeated elements with dynamic datas code optimize in angular7