【发布时间】:2021-02-13 16:04:07
【问题描述】:
我知道你永远不应该在 Angulars 模板表达式中使用函数调用,否则它们将被永久调用并且应用程序将受到极大的压力。 (见Medium - Why You Should Never Use Function Calls In Angular Template Expressions)
我也知道,当使用 []-array-operator 时没问题。例如
<div *ngIf="array[i]"></div>
有谁知道在这样的模板表达式中使用函数 Map.prototype.get() 是否可以?
<!-- 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>
【问题讨论】:
标签: angular ngfor angular-ng-if property-binding