Skip to main content

Posts

Showing posts with the label How to create a globally available custom “Pipe”?

How To Create and Use custom Pipes in Angular 2?

How to create a custom Pipes? How to create a globally available custom “Pipe”? The “@Pipe” decorator allows us to define the pipe name that is globally available for use in any template in the across application. Stayed Informed -   What is Pipes? Why use Pipes? Steps for Creating a Custom Pipe:- 1.       Create a typescript class. 2.       Decorate the class using @Pipe. 3.       Implement PipeTransform interface. 4.       Override transform() method. 5.       Configure the class in application module with @NgModule. 6.       Ready to use our custom pipe anywhere in application. In the below example , I am using the custom pipe in the user temple to display our custom “Ids” values at the place of Id. Table of Component 1.       user.component.ts 2.    ...