Open In App

Angular 10 UpperCasePipe

Last Updated : 28 Apr, 2021
Comments
Improve
Suggest changes
Like Article
Like
Report

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

The UpperCasePipe is used to Transforms all the text to uppercase.

Syntax:

{{ value | uppercase }}

NgModule: Module used by UpperCasePipe is:

  • CommonModule

Approach: 

  • Create the angular app to be used
  • There is no need for any import for the UpperCasePipe to be used
  • In app.component.ts define the variables that takes the UpperCasePipe value.
  • In app.component.html use the above syntax with '|' symbol to make UpperCasePipe element.
  • serve the angular app using ng serve to see the output

Input value:

  • value: it takes an string value.

Example 1:

app.component.ts
import { Component, OnInit }
        from '@angular/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html'
})
export class AppComponent {
    // Key Value object
    value : string = 'geeksforgeeks';
  }
app.component.html
<b>
  <div>
    Uppercase value is :
    {{value | uppercase}}
  </div>
</b>

Output:

Example 2:

app.component.ts
import { Component, OnInit } 
        from '@angular/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html'
})
export class AppComponent {
    value : string = 'CamelCase String';
  }
app.component.html
<b>
  <div>
    CamelCase value is : 
    {{value}}
  </div>
  <div>
    Uppercase value is : 
    {{value | uppercase}}
  </div>
</b>

Output:

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


Next Article

Similar Reads