Pure vs Impure Pipes
Understand pipe change detection behavior.
Pure Pipes by Default
Every pipe is pure by default. A pure pipe only re-runs when its input value or arguments change by reference.
Why Pure Pipes Are Fast
Angular skips calling a pure pipe during change detection if the input reference has not changed. This makes pure pipes efficient.
@Pipe({ name: "exclaim", standalone: true })
export class ExclaimPipe implements PipeTransform {
transform(value: string) { return value + "!"; }
}
// pure: only re-runs when value changesAll lessons in this course
- Using Built-in Pipes
- Chaining and Parameterizing Pipes
- Creating Custom Pipes
- Pure vs Impure Pipes