In this article, we are going to learn about Pipes in Angular 6.
Introduction
Pipes are used to format the data before displaying in the View. Pipe is used by using |. This symbol is called a Pipe Operator.
Types of pre-defined or built-in pipes in Angular 6.
- Lowercase
- Uppercase
- Titlecase
- Slice
- Json Pipe
- Number Pipe
- Percent Pipe
- Currency Pipe
- Date Pipe
Let's understand more about pipes in detail by using an example. Create a project using CLI.
ng new AngularPipes
Open this project using the below command.
Code .
Step 1
Open app.component.ts.
Syntax - Text|lowercase
Uppercase
Syntax - Text|uppercase
Code Snippets
App.component.ts
- import {
- Component
- } from '@angular/core';
- @Component({
- selector: 'app-root',
- template: `
- <h2>{{name|lowercase}}</h2>
- <h2>{{name|uppercase}}</h2>
- `,
- })
- export class AppComponent {
- name = 'Angular Pipes';
- }
Titlecase
Titlecase converts the first letter of a word in the uppercase.
Syntax - name|titlecase
Code Snippets
- import {
- Component
- } from '@angular/core';
- @Component({
- selector: 'app-root',
- template: `
- <h2>{{name|titlecase}}</h2>
- `,
- })
- export class AppComponent {
- name = 'Welcome to angular pipes project';
- }
Syntax - Text|slice:3

PandiyanPosted Sep 2, 2018, 1:49 AM
What are the types of pipes?
Bhairab DuttPosted Aug 31, 2018, 8:32 AM
Nice Article about Pipes ....