Tuesday, 1 May 2018

Pipes in Angular 2.

In this article, We will discuss about Pipes in angular 2.

Pipes is a built-in logic[class] to transform data into required format.

Pipes is similar to filters in angularjs.

Angular is providing following builtin pipes which is as follows,

1/ UpperCase Pipe:-
------------------------
This will convert string into UpperCase.

2/ LowerCase Pipe:-
------------------------
This will convert string into LowerCase.

3/ Number Pipe:-
---------------------
This will round up number to required fraction size[decimal].

Syntax:-
----------
varname|number:"minimumintegerpart:minfractionsize-maxfractionsize"

4/ Currency Pipe:-
----------------------
This can be used to display a number with currency symbol or code.

Syntax:-
----------
varname|currency:"currencycode:true|false:minintegerpart:minfractionsize-maxfractionsize"

5/ Percent Pipe:-
--------------------
This can be used to display percentage.

6/ Date Pipe:-
----------------
This can be used to display date in required format.

Syntax:-
---------
varname|date:format

0 comments:

Post a Comment