Return to site

Ecrire un pipe

What if the functionality doesn't exist in these built-in pipes

· angular

Introducing Custom Pipes

In the Angular Fundamentals course, we learned that pipes are handy ways of providing transformations to values on template binding. They're useful for all sorts of reasons, from formatting dates to capitalizing letters of lowercase-formatted data.
Angular already includes some “built-in” pipes that you can put to work immediately but what if the functionality doesn't exist in these built-in pipes, for a specific transformation that you want? This is where custom pipes come into play.
In a custom pipe, you write the logic in a function and that logic performs the necessary transformation that you desire.

Creating Custom Pipes

To create a custom pipe