Angular Pipes

Angular Pipes with Examples

In this article, I will discuss Angular Pipes with examples. Please read our previous article on Angular Directives with Examples. As we already know, every web application follows a very common flow:

  1. Get the data
  2. Transform the data
  3. Display the formatted data to the user

Getting the data is usually straightforward. We can:

  • Store it in a local variable,
  • Use a complex object/model,
  • Or fetch it from an API or database.

But the data we get is mostly raw, and raw data is not always suitable for direct display. For example:

  • A date might come as 2026-02-01T10:35:00, which is correct but not user-friendly.
  • A price might come as 6497.85, but users expect ₹6,497.85.
  • A name might come as pranaya rout, but users expect Pranaya Rout.
  • Large strings or arrays may need trimming or partial display.

So yes, we can show raw data to the end-user, but that results in:

  • Poor readability,
  • Unprofessional UI,
  • And a bad user experience.

To provide a good user experience, we must format and present data properly. This is where Angular Pipes become important. Angular Pipes provide a clean, built-in way to transform data only for display, directly in the template, without changing the original value. They help us keep formatting close to the UI where it belongs.

Without Pipes:

If we don’t use pipes, we usually do formatting in the component:

  • We write extra helper methods, such as formatdate(), formatprice(), totitlecase(), etc.
  • We keep calling these methods from the template

This causes problems:

  • Formatting logic goes inside the component
  • Components become fat and messy
  • Logic and UI formatting get mixed together
  • Code becomes harder to read, debug, and maintain
  • The same formatting logic gets duplicated across multiple components
With Pipes:

Pipes move the formatting responsibility to the template:

  • UI formatting stays in the Template
  • Component stays clean and focused on data + behaviour
  • Better readability and maintainability

What are Pipes in Angular?

An Angular Pipe takes raw data as input and transforms it into a more readable and user-friendly format before displaying it in the UI. In simple terms, pipes help us present data to end users properly without writing extra formatting code inside the component. So, we can say that Angular Pipes transform data into a specific format for display purposes only.

A Pipe in Angular is a simple, clean way to transform data directly in the template before displaying it to the user.

  • Pipes do not change the original data stored in the component or model
  • They only change how the data is displayed in the UI
  • This means the same raw value can be shown in different formats in different places when needed

Simple Idea: Data comes from Component → Pipe formats it → Template displays it. For a better understanding, please have a look at the image below:

What are Pipes in Angular?

So:

  • Pipes don’t change the actual data stored in the component
  • They only change how it looks in the UI

Types of Pipes in Angular:

Angular divides pipes into two main types:

  1. Built-in Pipes
  2. Custom Pipes

Further, Built-in Pipes can be used in two common ways:

  • Parameterized Pipes (pipes that accept arguments)
  • Chaining Pipes (applying multiple pipes one after another)

This is exactly what your diagram represents. For a better understanding, please have a look at the below image.

Types of Pipes in Angular

Built-in Pipes (Provided by Angular)

Angular provides many ready-made pipes for common UI formatting needs, such as:

  • date → Formats date values for display
  • uppercase → Converts string to uppercase
  • lowercase → Converts string to lowercase
  • currency → Formats numbers as currency
  • percent → Formats numbers as percentages
  • slice → Extracts a portion of a string/array

These built-in pipes cover most real-world formatting requirements in UI.

Custom Pipes

Custom pipes are:

  • Created by developers
  • Used when the formatting requirement is application-specific
  • Helpful when the same formatting logic is required in multiple places

Examples:

  • Masking sensitive data (like PAN, Aadhaar)
  • Converting status codes into readable labels
  • Formatting product codes or invoice formats
Syntax to use Pipes in Angular:

Pipes are used inside HTML templates. Using the pipe operator |, we can apply a pipe to any property or expression and display the formatted/transformed output. To apply a pipe, we use this syntax:

  • {{ value | pipeName }}

This means: take the value, transform it using the specified pipe, and then display it.

What are Angular Parameterized Pipes?

Some Angular pipes accept parameters (arguments) to control how they format output. For example:

  • How should the date look? (dd-MMM-yyyy or MM/dd/yyyy)
  • Which currency should be shown? (INR, USD)
  • How many decimals should be displayed?
  • How many items should be displayed from an array?

Syntax

  • {{ value | pipeName:param1:param2 }}

So, the pipe operator | basically means: Take this value and pass it through the pipe for formatting.

Examples

  • Date formatting (Parameterized date pipe):
      • {{ today | date:’dd-MMM-yyyy’ }}
  • Currency formatting (Parameterized currency pipe):
      • {{ price | currency:’INR’:’symbol’:’1.2-2′ }}
  • Meaning:
      • INR → Indian Rupee
      • symbol → show ₹
      • 1.2-2 → minimum 2 decimals, maximum 2 decimals
  • Slice pipe (Parameterized slice pipe):
      • {{ items | slice:0:3 }}
      • Meaning:
          • show items from index 0 to 2 (3 items)

So, Parameterized Pipes are simply: Pipes that allow you to control formatting using arguments.

What is Chaining Multiple Pipes?

Chaining means applying multiple pipes to the same value, one after another. The output of the first pipe becomes the input to the next pipe.

Example

  • {{ name | uppercase | slice:0:5 }}

Flow

  1. name → uppercase
  2. output of uppercase → slice

So, if name = “angular pipes”

  • uppercase becomes “ANGULAR PIPES”
  • slice:0:5 becomes “ANGUL”

Important Rule: You can chain pipes freely, as long as the output type of one pipe matches the input requirement of the next pipe.

Example:

  • uppercase returns a string → slice works on strings
  • But if one pipe returns an object and the next expects a string, chaining won’t make sense.

Chaining is very useful for clean UI formatting without writing extra logic in the component.

Real-time Application to Understand Angular Built-in Pipes:

This application represents a typical real-world e-commerce order details page, similar to what users see in Amazon, Flipkart, or internal admin dashboards. The primary learning goal of this screen is not CRUD or API handling, but to demonstrate how Angular built-in pipes transform raw backend data into user-friendly UI output.

Real-time Application to Understand Angular Built-in Pipes

This page is a single Order Details screen—exactly what we see in most real-time e-commerce/admin systems:

  • When an admin opens an order (ex, ORD-2026-2049)
  • They must instantly understand who placed it, how it was paid, what items were ordered, and the final totals
  • Most of the data coming from the API is raw (dates, numbers, strings, decimals)
  • Before showing it to users, the UI must format it properly

This is where Angular Pipes are used: they transform raw values into human-friendly display formats, without writing formatting logic in the component.

Creating a New Angular Project and Component
  • ng new OrderManagementDashboard
  • cd OrderManagementDashboard
  • ng generate component orders

This creates:

  • A fully configured Angular app
  • A component to build our real-time dashboard UI
Add Bootstrap CDN

Open src/index.html file, and copy-paste the following code. This is the single HTML host page that loads our Angular app. Here, we add the Bootstrap CDN, so our entire UI receives Bootstrap styling without installing anything else.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Order Managemen tDashboard</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <link
    href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
    rel="stylesheet"/>

</head>
<body>
  <app-root></app-root>
</body>
</html>
Create a Shared Model (Data Contract)

First, create a folder named models within the src/app/ folder. Then add a file named order.model.ts to the src/app/models folder and paste the following code. This file defines the data contract for the Order Details screen. It represents how order-related data (customer, address, payment, items, totals) is structured when coming from an API. The model itself contains raw values, while formatting is intentionally left to Angular Pipes in the template.

/**
 * Address
 * Represents a delivery address (or billing address).
 * Kept as a separate interface so it can be reused across multiple models.
 */
export interface Address {
  line1: string;
  line2?: string;
  city: string;
  state: string;
  pincode: string;
}

/**
 * Customer
 * Basic customer information returned along with the order details.
 * In real systems, this might come from a separate "Customer Service" or "User Service".
 */
export interface Customer {
  customerId: number;
  fullName: string;
  email: string;
  mobile: string;
  isPremium: boolean;
}

/**
 * PaymentInfo
 * Payment details for the order.
 */
export interface PaymentInfo {
  method: 'UPI' | 'Card' | 'NetBanking' | 'COD';
  transactionId?: string;
  paidOn?: Date;
  paymentStatus: 'Paid' | 'Pending' | 'Failed';
}

/**
 * OrderItem
 * A single line item in the order.
 */
export interface OrderItem {
  sku: string;
  productName: string;
  unitPrice: number;
  quantity: number;
  discountPercent: number;
  gstPercent: number;
  lineTotal: number;
}

/**
 * OrderTotals
 * Final totals returned by the API (source of truth).
 * UI shows these values directly.
 */
export interface OrderTotals {
  subTotalTaxable: number;
  totalGst: number;
  grandTotal: number;
}

/**
 * Order (Main Contract)
 * The complete Order Details response returned by API.
 *
 * This model is designed specifically for an "Order Details" page:
 * - Includes customer, address, payment, item list
 * - Includes server-calculated totals (totals + lineTotal)
 * - UI uses pipes to format date, currency, percent, etc.
 */
export interface Order {
  orderId: string;
  orderDate: Date;
  status: 'Placed' | 'Packed' | 'Shipped' | 'Delivered' | 'Cancelled';
  customer: Customer;
  deliveryAddress: Address;
  payment: PaymentInfo;
  items: OrderItem[];
  totals: OrderTotals;
}
Orders Component (Logic + Async Data)

Open the src/app/orders/orders.ts file, and copy-paste the following code. This file acts as the data provider and controller for the Order Details page. It stores raw order data, exposes helper methods for UI decisions (such as badge colors and totals), and keeps business logic separate from formatting, which is handled entirely by pipes in the template.

// Angular core imports
// Component    → Marks this class as an Angular component
// CommonModule → Provides common directives and pipes
//                such as ngModel, ngStyle, date, currency, etc.
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';

// Import the shared Order data model
// This defines the structure of the order object used by this component
import { Order } from '../models/order.model';

@Component({
  selector: 'app-orders',

  // Standalone component (Angular 15+)
  // This component can be imported directly without declaring it in an NgModule.
  standalone: true,

  // CommonModule gives template access to:
  // - Built-in directives like ngModel, ngClass, ngStyle
  // - Built-in pipes like date, currency, number, percent, uppercase, titlecase, etc.
  imports: [CommonModule],

  // External HTML template for clean separation of UI and logic
  templateUrl: './orders.html'
})
export class Orders {

  // Demo Data (Mock Order)
  // This object simulates a real API response so your template can display:
  // - Order summary (id, date, status)
  // - Customer details
  // - Address details
  // - Payment info
  // - Item list + totals
  //
  // Having it typed as Order ensures:
  // - compile-time checking (no missing fields)
  // - IntelliSense/autocomplete
  // - safer refactoring
  order: Order = {
    orderId: 'ORD-2026-2049',
    orderDate: new Date('2026-02-01T10:35:00'),
    status: 'Shipped',

    customer: { customerId: 101, fullName: 'pranaya rout', email: 'pranaya@example.com', mobile: '+91 98765 43210', isPremium: true },

    deliveryAddress: { line1: 'Plot 12, Jayadev Vihar', line2: 'Near Main Road', city: 'Bhubaneswar', state: 'Odisha', pincode: '751013' },

    payment: { method: 'UPI', transactionId: 'UPI-9F2A1XK81', paidOn: new Date('2026-02-01T10:36:00'), paymentStatus: 'Paid' },

    items: [
      { sku: 'KB-1021', productName: 'mechanical keyboard', unitPrice: 3499.5, quantity: 1, discountPercent: 10, gstPercent: 18, lineTotal: 3716.47 },
      { sku: 'MS-3090', productName: 'wireless mouse', unitPrice: 899, quantity: 2, discountPercent: 5, gstPercent: 18, lineTotal: 2016.06 },
      { sku: 'HB-2201', productName: 'usb hub', unitPrice: 649, quantity: 1, discountPercent: 0, gstPercent: 18, lineTotal: 765.82 }
    ],

    totals: {
      subTotalTaxable: 5506.65,
      totalGst: 991.20,
      grandTotal: 6497.85
    }
  };

  // UI Helper: Total quantity of items in this order
  // Loop through each item and add its quantity.
  getTotalItems(order: Order): number {
    let total = 0;

    // Go through every item in the order
    for (const item of order.items) {
      total += item.quantity; // add current item's quantity to total
    }

    return total;
  }

  // UI Helper: Returns a Bootstrap badge class based on Order Status
  // Purpose:
  // - Keep the HTML clean (template only calls this method)
  // - Centralize "status → badge color" mapping in one place
  //
  // Example output:
  // 'bg-primary' means blue badge
  // 'bg-success' means green badge
  getStatusBadgeClass(status: Order['status']): string {
    switch (status) {
      case 'Delivered': return 'bg-success';          // green → completed
      case 'Shipped': return 'bg-primary';            // blue → in transit
      case 'Packed': return 'bg-warning text-dark';   // yellow → ready, warning tone
      case 'Placed': return 'bg-info text-dark';      // light blue → newly created
      case 'Cancelled': return 'bg-danger';           // red → cancelled
      default: return 'bg-secondary';                 // grey → unknown/other
    }
  }

  // UI Helper: Returns a Bootstrap badge class based on Payment Status
  // This is separate from order status because payment has its own lifecycle.
  //
  // Example:
  // Paid → green, Pending → yellow, Failed → red
  getPaymentBadgeClass(status: Order['payment']['paymentStatus']): string {
    switch (status) {
      case 'Paid': return 'bg-success';               // green → success
      case 'Pending': return 'bg-warning text-dark';  // yellow → waiting
      case 'Failed': return 'bg-danger';              // red → failure
      default: return 'bg-secondary';                 // grey → unknown/other
    }
  }
}
External Template (Bootstrap + Pipes + Directives)

Open the src/app/orders/orders.html file, and copy-paste the following code. This file presents raw order data in a user-friendly format. Angular Built-in Pipes are heavily used here to format dates, currency, numbers, percentages, and text casing directly in the UI. The template demonstrates parameterized and chained pipes, as well as consistent formatting, without adding logic to the component.

<div class="container my-4">

  <!-- Control Flow Binding:
       @if checks whether "order" has data.
       - If order exists → show UI
       - Else → show warning message -->
  @if (order) {

    <!-- 1st Row: Only 3 Cards -->
    <div class="row g-3 mb-3">

      <!-- 1) Order Summary -->
      <div class="col-12 col-lg-4">
        <div class="card shadow-sm border-0 h-100">
          <div class="card-header bg-primary text-white py-2 fw-semibold">Order Summary</div>
          <div class="card-body">

            <div class="d-flex justify-content-between align-items-start">
              <div>
                <div class="text-muted small">Order ID</div>

                <!-- Interpolation Binding:
                     {{ ... }} renders a TypeScript value into HTML.

                     Pipe Chaining:
                     order.orderId | uppercase | slice:0:18
                     - uppercase → converts the text to UPPERCASE
                     - slice:0:18 → shows only first 18 characters -->
                <div class="h5 mb-1">{{ order.orderId | uppercase | slice:0:18 }}</div>

                <div class="text-muted small mt-2">Order Date</div>

                <!-- Date Pipe (Parameterized):
                     date:'dd-MMM-yyyy, hh:mm a'
                     - formats a Date object into a user-friendly string
                     - Example: 01-Feb-2026, 10:35 AM -->
                <div class="fw-semibold">{{ order.orderDate | date:'dd-MMM-yyyy, hh:mm a' }}</div>
              </div>

              <!-- Property Binding:
                   [ngClass]="..."
                   - dynamically sets CSS class based on the status
                   - getStatusBadgeClass() returns Bootstrap badge class -->
              <span class="badge fs-6" [ngClass]="getStatusBadgeClass(order.status)">
                <!-- Interpolation: displays status text -->
                {{ order.status }}
              </span>
            </div>

            <hr />

            <div class="d-flex justify-content-between">
              <span class="text-muted">Total Items</span>

              <!-- Binding + Number Pipe:
                   getTotalItems(order) returns a number
                   number:'1.0-0' shows a whole number (no decimals) 
                   number:'minIntegerDigits.minFractionDigits-maxFractionDigits' -->
              <span class="fw-bold">{{ getTotalItems(order) | number:'1.0-0' }}</span>
            </div>

            <div class="d-flex justify-content-between mt-2">
              <span class="text-muted">Grand Total</span>
              <span class="fw-bold">

                <!-- Currency Pipe (Parameterized):
                     currency:'INR':'symbol':'1.2-2'
                     - INR → format as Indian Rupee
                     - symbol → show ₹
                     - 1.2-2 → always show 2 decimal places -->
                {{ order.totals.grandTotal | currency:'INR':'symbol':'1.2-2' }}
              </span>
            </div>

            <div class="text-muted small mt-2">
              Total GST:

              <!-- Currency Pipe:
                   Formats GST numeric value as ₹ currency -->
              <b>{{ order.totals.totalGst | currency:'INR':'symbol':'1.2-2' }}</b>
            </div>

          </div>
        </div>
      </div>

      <!-- 2) Customer -->
      <div class="col-12 col-lg-4">
        <div class="card shadow-sm border-0 h-100">
          <div class="card-header bg-primary text-white py-2 fw-semibold">Customer</div>
          <div class="card-body">

            <div class="d-flex justify-content-between align-items-start">
              <div>

                <!-- Pipe Chaining:
                     titlecase | slice:0:26
                     - titlecase → converts "john doe" to "John Doe"
                     - slice:0:26 → restricts long names to first 26 chars -->
                <div class="h5 mb-1">{{ order.customer.fullName | titlecase | slice:0:26 }}</div>

                <!-- Interpolation:
                     Directly prints email/mobile strings -->
                <div class="text-muted small">{{ order.customer.email }}</div>
                <div class="text-muted small">Mobile: {{ order.customer.mobile }}</div>
              </div>

              <!-- Conditional Expression Binding:
                   order.customer.isPremium ? 'bg-success' : 'bg-secondary'
                   - sets badge color based on boolean -->
              <span class="badge fs-6" [ngClass]="order.customer.isPremium ? 'bg-success' : 'bg-secondary'">
                <!-- Conditional Text Rendering -->
                {{ order.customer.isPremium ? 'Premium' : 'Standard' }}
              </span>
            </div>

            <hr />

            <div class="text-muted small mb-1">Delivery Address</div>
            <div class="small">
              <div class="fw-semibold">{{ order.deliveryAddress.line1 }}</div>

              <!-- Control Flow Binding:
                   show line2 only if it exists (not empty/null) -->
              @if (order.deliveryAddress.line2) {
                <div>{{ order.deliveryAddress.line2 }}</div>
              }

              <div>
                <!-- Titlecase Pipe:
                     makes city/state look proper in UI -->
                {{ order.deliveryAddress.city | titlecase }},
                {{ order.deliveryAddress.state | titlecase }} -
                <b>{{ order.deliveryAddress.pincode }}</b>
              </div>
            </div>

          </div>
        </div>
      </div>

      <!-- 3) Payment -->
      <div class="col-12 col-lg-4">
        <div class="card shadow-sm border-0 h-100">
          <div class="card-header bg-primary text-white py-2 fw-semibold">Payment</div>
          <div class="card-body">

            <div class="d-flex justify-content-between align-items-start">
              <div>
                <div class="text-muted small">Method</div>
                <div class="fw-semibold">{{ order.payment.method }}</div>

                <div class="text-muted small mt-2">Transaction</div>

                <!-- Safe Conditional Rendering inside interpolation:
                     If transactionId exists → show formatted value
                     Else → show 'N/A'

                     Pipe Chaining:
                     uppercase | slice:0:18
                     - uppercase → makes id uppercase
                     - slice → prevents long id from breaking UI -->
                <div class="fw-semibold">
                  {{ order.payment.transactionId ? (order.payment.transactionId | uppercase | slice:0:18) : 'N/A' }}
                </div>

                <!-- Control Flow:
                     show "Paid On" only if paidOn date exists -->
                @if (order.payment.paidOn) {
                  <div class="text-muted small mt-2">
                    Paid On:

                    <!-- Date Pipe:
                         formats the Date into readable form -->
                    <b>{{ order.payment.paidOn | date:'dd-MMM, hh:mm a' }}</b>
                  </div>
                }
              </div>

              <!-- [ngClass] binding:
                   Payment status controls badge color -->
              <span class="badge fs-6" [ngClass]="getPaymentBadgeClass(order.payment.paymentStatus)">
                {{ order.payment.paymentStatus }}
              </span>
            </div>

          </div>
        </div>
      </div>
    </div>

    <!-- Order Items -->
    <div class="card shadow-sm border-0 mb-2">
      <div class="card-header bg-primary text-white py-2 d-flex justify-content-between align-items-center">
        <div class="fw-semibold">Order Items</div>
        <div class="small opacity-75">
          Total Items:

          <!-- Number Pipe:
               shows total items without decimals -->
          <b>{{ getTotalItems(order) | number:'1.0-0' }}</b>
        </div>
      </div>

      <div class="card-body">
        <div class="table-responsive">
          <table class="table table-sm align-middle mb-0">
            <thead class="table-light">
              <tr>
                <th>SKU</th>
                <th>Product</th>
                <th class="text-end">Unit</th>
                <th class="text-end">Qty</th>
                <th class="text-end">Disc</th>
                <th class="text-end">GST</th>
                <th class="text-end">Line Total</th>
              </tr>
            </thead>

            <tbody>
              <!-- Loop Binding:
                   @for renders one <tr> per item in order.items
                   track item.sku helps Angular optimize DOM updates -->
              @for (item of order.items; track item.sku) {
                <tr>

                  <!-- Uppercase Pipe:
                       makes SKU consistent in UI -->
                  <td class="text-muted">{{ item.sku | uppercase }}</td>

                  <!-- Titlecase Pipe:
                       displays product names in proper format -->
                  <td class="fw-semibold">{{ item.productName | titlecase }}</td>

                  <!-- Currency Pipe:
                       formats numbers as INR with ₹ symbol -->
                  <td class="text-end">{{ item.unitPrice | currency:'INR':'symbol':'1.0-2' }}</td>

                  <!-- Number Pipe:
                       ensures qty appears as integer -->
                  <td class="text-end">{{ item.quantity | number:'1.0-0' }}</td>

                  <!-- Percent Pipe:
                       percent pipe expects 0.10 for 10%, so we convert 10 → 0.10 using /100 -->
                  <td class="text-end">{{ (item.discountPercent / 100) | percent:'1.0-0' }}</td>

                  <!-- Percent Pipe:
                       converts 18 → 0.18 so percent pipe shows 18% -->
                  <td class="text-end">{{ (item.gstPercent / 100) | percent:'1.0-0' }}</td>

                  <!-- Currency Pipe:
                       lineTotal is calculated earlier (API / component)
                       template only formats and displays it -->
                  <td class="text-end fw-bold">{{ item.lineTotal | currency:'INR':'symbol':'1.2-2' }}</td>
                </tr>
              }
            </tbody>
          </table>
        </div>
      </div>
    </div>

    <!-- Totals (right aligned) -->
    <div class="row">
      <div class="col-12 col-lg-5 ms-auto">
        <div class="border rounded-3 p-3 bg-white shadow-sm">
          <div class="d-flex justify-content-between">
            <span class="text-muted">Subtotal (Taxable)</span>

            <!-- Currency Pipe:
                 formats subtotal as INR -->
            <span class="fw-semibold">{{ order.totals.subTotalTaxable | currency:'INR':'symbol':'1.2-2' }}</span>
          </div>

          <div class="d-flex justify-content-between mt-2">
            <span class="text-muted">Total GST</span>

            <!-- Currency Pipe:
                 formats GST as INR -->
            <span class="fw-semibold">{{ order.totals.totalGst | currency:'INR':'symbol':'1.2-2' }}</span>
          </div>

          <hr class="my-2" />

          <div class="d-flex justify-content-between">
            <span class="fw-bold">Grand Total</span>

            <!-- Currency Pipe:
                 formats grand total as INR -->
            <span class="fw-bold">{{ order.totals.grandTotal | currency:'INR':'symbol':'1.2-2' }}</span>
          </div>
        </div>
      </div>
    </div>

  } @else {
    <!-- Fallback UI:
         If order is null/undefined, show a friendly message -->
    <div class="alert alert-warning shadow-sm">
      No order details found.
    </div>
  }

</div>
Update the Root Component

Open src/app/app.ts file, and copy-paste the following code. This file serves as the application’s entry point. It simply loads the Orders component and contains no formatting or business logic, reinforcing the idea that formatting responsibility belongs to pipes and UI components, not the root setup.

import { Component } from '@angular/core';
import { Orders } from './orders/orders';

@Component({
  selector: 'app-root',
  imports: [Orders],
  templateUrl: './app.html',
  styleUrl: './app.css'
})
export class App {
}
Update the Root Template

Open src/app/app.html file, and copy-paste the following code. This file acts as the application shell, rendering the Orders component. It keeps the root layout minimal and delegates all UI responsibility to feature components, supporting clean separation of concerns.

<app-orders></app-orders>
Conclusion: Why Angular Pipes Matter?

Angular Pipes help you present raw data (dates, prices, names, percentages, etc.) in a clean and user-friendly way directly in the template, without pushing formatting logic into the component. They improve UI readability, keep components focused on data/behaviour (not formatting), and make formatting consistent and reusable across the application—while keeping the original data unchanged.

In the next article, I will discuss Custom Pipes in Angular with Examples. In this article, I explain Angular Pipes with examples. I would like to have your feedback. Please post your feedback, questions, or comments about this article.

Leave a Reply

Your email address will not be published. Required fields are marked *