Is it possible to use a pipe in the code? [duplicate]

First declare the pipe in the providers of your module: import { YourPipeComponentName } from ‘your_component_path’; @NgModule({ providers: [ YourPipeComponentName ] }) export class YourServiceModule { } Then you can use @Pipe in a component like this: import { YourPipeComponentName } from ‘your_component_path’; class YourService { constructor(private pipe: YourPipeComponentName) {} YourFunction(value) { this.pipe.transform(value, ‘pipeFilter’); } … Read more

Format date as dd/MM/yyyy using pipes

Pipe date format bug fixed in Angular 2.0.0-rc.2, this Pull Request. Now we can do the conventional way: {{valueDate | date: ‘dd/MM/yyyy’}} Examples: Current Version: Example Angular 13 Old Versions: Example Angular 8.x.x Example Angular 7.x Example Angular 6.x Example Angular 4.x Example Angular 2.x More info in documentation DatePipe