• Home
  • Categories
  • Video Tutorials
    • Angular 5
  • News
  • About us
  • Contact us
  • Login
test
Code4Developers

Code4Developers

Code4Developers
  • Home
  • Categories
  • Video Tutorials
    • Angular 5
  • News
  • About us
  • Contact us
  • Login
  • Angular

Pipes in Angular Part – 1 : lowercase, uppercase, and titlecase pipes

  • Yatendrasinh Joddha
  • June 30, 2018
  • 2 minute read
Angular
Total
0
Shares
0
0
0

In this series of article for the angular rookies we will discuss about pipes in Angular, a way to write display-value transformations that you can declare in your HTML. In this article we will discuss about lowercase, uppercase, and titlecase pipes. At the end of the series we will create our own custom pipes.

Lowercase pipe

The lowercase pipe is used to transform text to all lower-case format.

Syntax: {{ value | lowercase}}

Please consider below example

<div style="text-align:center">
  <h1>
    {{'Welcome to the demo of LOWERCASE pipe' | lowercase}}
  </h1>
</div>

Output:lowecase output

 

Uppercase pipe

The uppercase pipe is used to transform text to all upper-case format.

Syntax: {{ value | uppercase}}

Please consider below example

</div><div style="text-align:center">
  <h1>
    {{'Welcome To The Demo of UPPERCASE pipe' | uppercase}}
  </h1>
</div>

Output:

Titlecase pipe

The titlecase pipe is used to transform first character of the word to capital and rest word to lower case. Words are delimited by any white space character, such as a space, tab, or line-feed character.

Syntax: {{ value | titlecase}}

Please consider below example

<div style="text-align:center">
  <h1>
    {{'Welcome To The Demo of TITLECASE pipe' | titlecase}}
  </h1>
</div>

Output:

The pipes can also be applied to the variable. Consider the below example in which you have variable called ‘statement’ on which we are going to apply pipes.

Component

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  statement = 'Welcome To The Demo of TITLECASE pipe';
}

Applying pipes

<div style="text-align:center">
  <h1>
    {{statement | titlecase}}
  </h1>
</div>

Example

Consider the example where we will write a message into the textbox and we will transform the text using above pipes

app.component.ts

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  value: string;
  toLoweUpper(value: string) { this.value = value; }
}

app.component.html

<div style="text-align:left">
  <label>Name: </label><input #name (keyup)="toLoweUpper(name.message)" type="text">
  <p>In lowercase: '{{value | lowercase}}'
  <p>In uppercase: '{{value | uppercase}}'
  <p>In titlecase: '{{value | titlecase}}'
</div>

Output

example output

Summary:

This article is for rookie angular developers. If you are not aware about how to get start with angular you can read other articles from the Angular section from this website.

Some useful articles for beginners:

  • Angular 4 Installations
  • Angular 4 Project Structure
Yatendrasinh Joddha
Yatendrasinh Joddha

I have healthy knowledge and experience in Azure, O365 and ASP.Net with c#, MVC, WebApi along with client-side frameworks and libraries like JavaScript, JQuery, KnockoutJs, AngularJs, Angular, ReactJs, NodeJs

Views: 14,255

Share this:

  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on X (Opens in new window) X
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to email a link to a friend (Opens in new window) Email
  • Click to print (Opens in new window) Print

Like this:

Like Loading...

Related Posts

Total
0
Shares
Share 0
Tweet 0
Pin it 0

Leave a ReplyCancel reply

Subscribe to Website via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Recent Posts
  • Getting Started with AWS Step Functions: Orchestration Made Simple

    Getting Started with AWS Step Functions: Orchestration Made Simple

    2 months ago
  • React Hooks Guide: Top Tips for Optimizing Performance in Your React Applications

    React Hooks Guide: Top Tips for Optimizing Performance in Your React Applications

    2 years ago
  • Demystifying JavaScript Tree Shaking: Boosting Performance and Reducing Bundle Size

    Demystifying JavaScript Tree Shaking: Boosting Performance and Reducing Bundle Size

    2 years ago
  • Unlocking the Power of React Hooks: A Comprehensive Guide with Examples

    Unlocking the Power of React Hooks: A Comprehensive Guide with Examples

    2 years ago
  • Celebrating a Decade of Phenomenal Growth: Insights and Reflections on 10 Years of Software Engineering

    Celebrating a Decade of Phenomenal Growth: Insights and Reflections on 10 Years of Software Engineering

    2 years ago
  • Angular Custom Elements: Creating Reusable Components with Angular

    Angular Custom Elements: Creating Reusable Components with Angular

    2 years ago
  • Connect Firebase Realtime NoSQL Database with Angular App from Scratch

    Connect Firebase Realtime NoSQL Database with Angular App from Scratch

    5 years ago
  • How to Build an Inclusive Esports Community

    How to Build an Inclusive Esports Community

    5 years ago
  • Best Digital Icebreakers

    Best Digital Icebreakers

    5 years ago
  • Email alerts when a docker container stopped in AWS ECS CLUSTER

    Email alerts when a docker container stopped in AWS ECS CLUSTER

    5 years ago
Subscribe to Website via Email

Enter your email address to subscribe to this website and receive notifications of new posts by email.

Featured Posts
  • javascript 1
    Spread syntax (three dots) in JavaScript
    • March 21, 2018
  • Angular 2
    Angular 6 CRUD – Part 1: Project Setup, Routing, Service
    • May 9, 2018
  • javascript 3
    Local Storage and Session Storage
    • May 22, 2017
  • Angular 4
    Angular 4 Project Structure
    • June 18, 2017
  • AWS 5
    Email alerts when a docker container stopped in AWS ECS CLUSTER
    • July 24, 2020
Code4Developers
Learning is never ending process

Input your search keywords and press Enter.

 

Loading Comments...
 

    %d