Angular 2 Pipes

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!


The pipe | character is used to apply pipes in Angular 2. Pipes are very similar to filters in AngularJS in that they both help to transform the data into a specified format.


@Pipe({name, pure})metadata for pipe, must immediately precede pipe class
name: stringwhat you will use inside the template
pure: booleandefaults to true, mark this as false to have your pipe re-evaluated more often
transform( value, args[]? )the function that is called to transform the values in the template
value: anythe value that you want to transform
args: any[]the arguments that you may need included in your transform. Mark optional args with the ? operator like so transform(value, arg1, arg2?)


This topic covers Angular2 Pipes, a mechanism for transforming and formatting data within HTML templates in an Angular2 application.

Got any Angular 2 Question?