How do I get the transformed array in my component.ts file after "|" has been applied? Please help.
Asked
Active
Viewed 35 times
-3
-
Just apply the pipe in the component... – Roberto Zvjerković Oct 29 '18 at 09:07
-
this might helps you: https://stackoverflow.com/questions/35144821/angular-use-pipes-in-services-and-components – Ketan Akbari Oct 29 '18 at 09:15
1 Answers
0
You can just apply the pipe in the component.
Here you can find an example using the date pipe like this:
import { DatePipe } from '@angular/common';
class MyService {
constructor(private datePipe: DatePipe) {}
transformDate(date) {
return this.datePipe.transform(date, 'yyyy-MM-dd');
}
}
Depending on your pipe you need to modify the code to your own needs.

Tommy
- 2,355
- 1
- 19
- 48