> ## Documentation Index
> Fetch the complete documentation index at: https://loadwise.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# angular-template-method-call

> An Angular template binding calls a component method that loops over a collection, so the loop reruns on every change detection pass.

## What it flags

An interpolation, property binding, structural directive or control-flow block (`{{ total() }}`, `[count]="lineCount()"`, `*ngIf="hasDiscount()"`, `@if (expensiveLines().length)`) in a component's inline or `templateUrl` template calls a method of that component, or reads a getter, whose body loops over a collection. A loop statement, an array method that visits every element (`filter`, `map`, `reduce`, `sort`, `some` and similar), or a call to another such member counts. A loop inside a callback the member only defines or returns, such as `return () => this.rows.sort(...)`, does not run when the binding is read and does not count. Neither does a method the body only references, such as `return this.calculate;`. Angular re-evaluates every binding on each change detection pass, so the loop reruns even when nothing it reads has changed.

Event bindings such as `(click)="checkout()"` run only on their event and are not reported, nor are methods that do no iteration, methods referenced only inside an HTML comment, names a template declares locally, object-literal keys such as `active` in `[ngClass]="{ active: isOn }"`, and pipe names such as `currency` in `{{ amount | currency }}`. The finding sits on the method or getter. In a component with `changeDetection: ChangeDetectionStrategy.OnPush`, the finding appears with `--include-contextual`, because the binding reruns only when that component is checked.

## How to review or fix

Compute the value once when its inputs change: a `computed()` signal, a field updated where the data changes (for example in `ngOnChanges` or after the request that loads it), or a pure pipe. Leave it when the collection always stays small.

## Configuration

Set the rule to `"off"` in `loadwise.config.json` to drop its findings:

```json theme={null}
{
  "rules": { "angular-template-method-call": "off" }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.