0 votes
in Angular by

What are pipes?

1 Answer

0 votes
by
Pipes are simple functions that use template expressions to accept data as input and transform it into 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

}
...