Angular 10 References/ Core


A pipe takes in data as input and transforms it to a desired output.


Here's a custom pipe that doubles a value:

import { Pipe, PipeTransform } from '@angular/core';

@Pipe({name: 'double'})
export class DoublePipe implements PipeTransform {
  transform(value: number): number {
    return value * 2;


{{ value | double }} 



name: string
The pipe name to use in template bindings.


pure?: boolean
When true, the pipe is pure, meaning that the `transform()` method is invoked only when its input arguments change. Pipes are pure by default.If the pipe has internal state (that is, the result depends on state other than its arguments), set pure to false. In this case, the pipe is invoked on each change-detection cycle, even if the arguments have not changed.