Skip to main content

Posts

Showing posts with the label PipeTransform Interface

What Is Angular DatePipe?

Angular DatePipe  - The DatePipe is used to format a date with the help of locale rules. {{  value_expression  |  date  [ :  format  [ :  timezone  [ :  locale  ] ] ] }} The Example for date pipe – The full date provides you full date for the date. The short date converts the date to a short date and the long date provides you long date for the date. < h3 > {{TodayDate}} </ h3 >   < h3 > {{TodayDate | date:'shortDate'}} </ h3 >   < h3 > {{TodayDate | date:'longDate'}} </ h3 >   < h3 > {{TodayDate | date:'fullDate'}} </ h3 > For more detail kindly refer this link click…

Angular PipeTransform Interface

What Is PipeTransform interface? The Pipe class implements the PipeTransform interface that accepts input value (It is optional parameters) and returns the transformed value. The transform method is an important method to a pipe. To create a Pipe, you must implement this interface. Angular invokes the transform method with the value of a binding as the first, and second argument in list form. The PipeTransform interface looks like - export   interface   PipeTransform  {      transform ( value :  any , ... args :  any []):  any ; } And it imported from Angular core - import  { Pipe ,  PipeTransform }  from   '@angular/core' ; Two Categories of Pipes in Angular – 1)        pure 2)        impure Every pipe has been pure by default. If you want to make a pipe impure that time you will allow the setting pure flag to fals...