In Angular (13) is there a way to assign the result of a function to a variable (in the .html
part of a component, not template) having multiple conditions in ngIf
<div *ngIf="let getMyVar() as myVar && isVisible && isClean">
{{ 'this is myVar: ' + myVar }}
</div>
if not what workaround is possible to implement?
did not find anything better than splitting the ngIf
in two
<ng-container *ngIf="getMyVar(); let myVar">
<div *ngIf="isVisible && isClean">
{{ 'this is myVar: ' + myVar }}
</div>
</ng-container>