Reader small image

You're reading from  Expert Angular

Product typeBook
Published inJul 2017
Reading LevelExpert
PublisherPackt
ISBN-139781785880230
Edition1st Edition
Languages
Right arrow
Author (1)
Sridhar Rao Chivukula
Sridhar Rao Chivukula
author image
Sridhar Rao Chivukula

Sridhar Rao Chivukula is a technical lead at Mindtree Ltd and is based out of New York City. He brings with him more than a decade of rich hands-on experience in all aspects of frontend engineering. He has worked with leading companies such as Oracle, Tech Mahindra, and Cognizant Technology Solutions. He has a Bachelor's degree in Information Technology. He is the author of the books Expert Angular and PHP and Web 2.0 Application Interfaces, published by Packt.
Read more about Sridhar Rao Chivukula

Right arrow

Defining a pipe

The pipe operator is defined with a pipe symbol, (|), followed by the name of the pipe:

{{ appvalue | pipename }}

The following is an example of a simple lowercase pipe:

{{"Sridhar Rao" | lowercase}} 

In the preceding code, we are transforming the text to lowercase using the lowercase pipe.

Now, let's write an example Component using the lowercase pipe example:

@Component({
selector: 'demo-pipe',
template: `
Author name is {{authorName | lowercase}}
`
})
export class DemoPipeComponent {
authorName = 'Sridhar Rao';
}

Let's analyze the preceding code in detail:

  • We defined a DemoPipeComponent component class
  • We created a string variable, authorName, and assigned the value, 'Sridhar Rao'
  • In the template view, we displayed authorName; however, before we printed it in the UI, we transformed it using the lowercase pipe...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Expert Angular
Published in: Jul 2017Publisher: PacktISBN-13: 9781785880230

Author (1)

author image
Sridhar Rao Chivukula

Sridhar Rao Chivukula is a technical lead at Mindtree Ltd and is based out of New York City. He brings with him more than a decade of rich hands-on experience in all aspects of frontend engineering. He has worked with leading companies such as Oracle, Tech Mahindra, and Cognizant Technology Solutions. He has a Bachelor's degree in Information Technology. He is the author of the books Expert Angular and PHP and Web 2.0 Application Interfaces, published by Packt.
Read more about Sridhar Rao Chivukula