AI Hints
Home›Angular Tutorial›Pipes, Built-in Pipes and Pipe Arguments
Angular · Lesson 56 of 120

Built-in Pipes

Ready to use.

⏱ 2 min read▶ Video at 1:06:15🎓 Free
Watch this lesson in the Angular courseWatch on YouTube ↗Full Angular course

Angular comes with pipes for the most common jobs. Text, money, dates, percentages, and numbers.

  • Common jobs
  • Ready made
  • @angular/common

Common pipes

Uppercase, lowercase, and title case change letters. Currency formats money. Date formats dates. Percent shows a fraction as a percentage. And number adds thousands separators.

PipeExample output
uppercase / titlecaseTHE HOBBIT / The Hobbit
currency£11.99
dateJul 29, 1954
percent15%
number150,000,000

Four pipes

Title case capitalises each word. Currency shows pounds. Date formats a date object. Percent turns nought point one five into fifteen percent. Run it. Every value is shown in a friendly format.

app.tstypescript
import { Component } from '@angular/core';
import { TitleCasePipe, CurrencyPipe, DatePipe, PercentPipe } from '@angular/common';

@Component({
  selector: 'app-root',
  imports: [TitleCasePipe, CurrencyPipe, DatePipe, PercentPipe],
  template: `
    <p>{{ title | titlecase }}</p>
    <p>{{ price | currency: 'GBP' }}</p>
    <p>{{ published | date }}</p>
    <p>{{ discount | percent }}</p>
  `,
})
export class App {
  title = 'the fellowship of the ring';
  price = 11.99;
  published = new Date('1954-07-29');
  discount = 0.15;
}

Summary

Angular's built-in pipes format text, money, dates, percentages, and numbers. Next, giving pipes arguments.

Key takeaways
  • titlecase
  • currency, date
  • percent, number
Next up: Pipe Arguments — fine tuning