inside the ngFor loop, there are 3 same function call - processStatus(status). Is there a way to call it only once inside the for loop by saving it in a parameter , and then refer to that parameter inside the ngFor?
<ng-container *ngFor="let status of processCompStatusOrder; let i = index;>
<div *ngIf="!!processStatus(status)">
<clr-icon class="icon" [attr.shape]="svc.getIcon(processStatus(status))"></clr-icon>
{{ 'base.' + processStatus(status)?.toLowerCase() | i18next }}
</div>
</ng-container>
processStatus(status) {
return this.process?.[status]?.process?.status;
}
My attempt below which doesn't work
<ng-container *ngFor="let status of processCompStatusOrder; let i = index; let p=processStatus(status)>
<div *ngIf="!!p">
<clr-icon class="icon" [attr.shape]="svc.getIcon(p)"></clr-icon>
{{ 'base.' + p?.toLowerCase() | i18next }}
</div>
</ng-container>