I am trying to call a function inside a loop.
How do I call a function and store the return value as temporary variable?
I need to use the return value to display.
Sample below code I want to achieve.
<div *ngFor="let list of sampleLists">
<div >
{{ var result = getMyFunction(list) }}
<div>
{{ result.Value}}
{{ result.Name}}
</div>
</div>
</div>
You can try :
<div *ngFor="let list of sampleLists">
<div *ngIf="getMyFunction(list) as result">
<div >
{{ result.Value}}
{{ result.Name}}
</div>
</div>
</div>