If I use Map.get('key1') in angular template, does the change detection mechanism check the...

Discussão em 'Angular' iniciado por José Bate, Julho 23, 2025.

  1. José Bate

    José Bate Guest

    I know it is not a good practice to call expressions from a template in angular, because angular cannot predict whether the return value of a function has changed, so it needs to execute the function every time change detection runs.

    My question is if angular will do the same behaviour for Map.get('key1') -> will it check the value of the map every change detection cycle, or no?

    Also, any idea on how I can test this myself?

    <ng-container *ngIf="myMap.get('key1')">....

    Continue reading...

Compartilhe esta Página