Ashish Patel: Notes

Atom feed

Recently added: Abstraction, Xunit, Publisher subscriber pattern, Request reply pattern, Middleware pattern

Pipes in Angular are used to transform data. It takes integers, strings, arrays, and date as input separated with | to be converted in the format as required and display the same in the browser.

Below are the built in pipes provied by Angular

  1. Lowercasepipe
  2. Uppercasepipe
  3. Datepipe
  4. Currencypipe
  5. Jsonpipe
  6. Percentpipe
  7. Decimalpipe
  8. Slicepipe

Custom pipe

To create a custom pipe, we have to import Pipe and Pipe transform from Angular/Core. We can use our custom pipe by importing it in app module.

import { Pipe, PipeTransform } from "@angular/core";
  name: "sqrt"
export class SqrtPipe implements PipeTransform {
  transform(val: number): number {
    return Math.sqrt(val);

Created 2019-01-23T11:45:03+05:18, updated 2022-01-29T02:34:00+00:00 · History · Edit