I have a dynamic table with rows generated using ngFor
<tbody>
<tr *ngFor="let item of Details">
<div class="row details-row row-cols-lg-2 row-cols-1" *ngIf="closureDetails">
<div class="col" [ngClass]="{'d-none':getMilestones(item.ProjectCode)?.length===0}">
<app-milestone [milestones]="getMilestones(item.ProjectCode)"></app-milestone>
</div>
<div class="col" [ngClass]="{'d-none':getRisks(item.ProjectCode)?.length===0}">
<app-risk [risks]="getRisks(item.ProjectCode)"></app-risk>
</div>
</div>
</tr>
</tbody>
In this setup, I am applying classes to the columns while passing data to child components. However, the function that handles this is triggering twice, causing a delay in processing due to multiple calls for each row.
This becomes inefficient when dealing with over 300 rows, resulting in unnecessary hits to the same function. I am looking for suggestions on optimizing this process to improve performance.