@Pipe
Declares a class as a template pipe for value transformation.
Syntax
@Pipe({ name: string, standalone?, pure? }) Parameters
| Name | Type | Required | Description |
|---|---|---|---|
config | object | No | Pipe metadata including name and optional pure flag. |
Returns
ClassDecorator — Decorator registering a transform pipe.
Examples
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'exclaim', standalone: true })
export class ExclaimPipe implements PipeTransform {
transform(value: string): string {
return `${value}!`;
}
}
// template usage
// {{ 'hello' | exclaim }} -> hello!
Notes
Implement PipeTransform's transform() method. Pure pipes (default) only
re-run when inputs change by reference, which is efficient; set `pure: false`
only when necessary. Add the pipe to a component's `imports` to use it.