Angular change detection loop triggered by using getters inside template Angular change detection loop triggered by using getters inside template angular angular

Angular change detection loop triggered by using getters inside template


Use ChangeDetectionStrategy.onPush

Run the following command to make this the default for your project when creating new components via the CLI.

ng config schematics.@schematics/angular.component.changeDetection OnPush

Generally speaking try to avoid complex getters or calling functions from within a template. If you need to transform data consider using Pipes, which are memoized.