Created
July 17, 2020 09:32
-
-
Save marcellkiss/24ff6b49f28622b30d043d2fef7c412b to your computer and use it in GitHub Desktop.
Custom Angular Pipe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`@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