In the previous posts we saw about the built-in pipes in Angular, their syntax, usage, chaining etc. Angular also provides us the ability to create our own Custom pipes to suite our requirement. When we cannot use any of the built-in pipes for our requirement we can create a custom Pipe. Also for larger applications, create custom pipes helps in reusing code/functionality.
Custom pipes are nothing but classes like Components and custom Directives, Custom pipe classes use the @Pipe decorator. The pipe class implements the PipeTransforminterface's transform method that accepts an input value followed by optional parameters and returns the transformed value.
While creating the custom pipe class, use the @Pipe decorator and specify the name of the custom pipe as follows.
Custom pipes are nothing but classes like Components and custom Directives, Custom pipe classes use the @Pipe decorator. The pipe class implements the PipeTransforminterface's transform method that accepts an input value followed by optional parameters and returns the transformed value.
While creating the custom pipe class, use the @Pipe decorator and specify the name of the custom pipe as follows.