Open In App

Angular10 TitleCasePipe

In this article, we are going to see what is TitleCasePipe in Angular 10 and how to use it.

TitleCasePipe is used to Transforms all the text to titlecase.



Syntax:

{{ value | TitleCasePipe }}

NgModule: Module used by TitleCasePipe is:



Approach: 

Input value:

Example 1:




import { Component, OnInit } from '@angular/core';
  
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html'
})
export class AppComponent {
    // Key Value object
    value : string = 'geeksforgeeks';
  }




<b>
  <div>
    titlecase value is : {{value | titlecase}}
  </div>
</b>

Output:

Example 2:




import { Component, OnInit } from '@angular/core';
  
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html'
})
export class AppComponent {
    // Key Value object
    value : string = 'geeksforgeeks';
  }




<b>
  <div>
    CamelCase value is : {{value}}
  </div>
  <div>
    TitleCase value is : {{value |titlecase}}
  </div>
</b>

Output:

Reference: https://angular.io/api/common/TitleCasePipe


Article Tags :