What are pipes?

A pipe takes in data as input and transforms it to a desired output. For example, let us take a pipe to transform a component's birthday property into a human-friendly date using date pipe.

import { Component } from '@angular/core';
@Component({
selector: 'app-birthday',
template: `<p>Birthday is {{ birthday | date }}</p>`,
})
export class BirthdayComponent {
birthday = new Date(1987, 6, 18); // June 18, 1987
}

April 24, 2022
590