Wednesday 11 November 2020

Is it ok to use the function Map.prototype.get() inside an Angular Template Expression?

I know that you should never use function calls within Angulars Template Expressions, otherwise they will be called permanently and the app will be extremely stressed. (see Medium - Why You Should Never Use Function Calls In Angular Template Expressions)

I also know that it is ok, when the []-array-operator is used. e.g.

<div *ngIf="array[i]"></div>

Does anyone know if it is ok to use the function Map.prototype.get() inside a template expression like this?

<!-- the Map is structured like Map<Object, Object[]> -->
<ng-container *ngFor="let elem of someMap.get(keyToAnArray)">
    <app-some-compo [elem]="elem"></app-some-compo>
</ng-container>


from Is it ok to use the function Map.prototype.get() inside an Angular Template Expression?

No comments:

Post a Comment