Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marcellkiss/24ff6b49f28622b30d043d2fef7c412b to your computer and use it in GitHub Desktop.
Save marcellkiss/24ff6b49f28622b30d043d2fef7c412b to your computer and use it in GitHub Desktop.
Custom Angular Pipe
`@Pipe({
name: 'myCustomPipe'
})
export class MyCustomPipe implements PipeTransform {
// Inject what you need
constructor(private datePipe: DatePipe) { }
transform(value: any, args?: string): any {
if (args.includes['date']) {
return this.datepipe.transform(value, 'yyyy-MM-dd');
} else if (args.includes('...')) {
...
}
}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment