I am programming an Angular4 application. I have an array contains values and pipe type. (regions, language or number)
const values = [
{ value: 'us', pipe: 'regions'},
{ value: 'en', pipe: 'language'},
{ value: '100', pipe: 'number'},
.....
];
and I want to make an ngFor so I can display the value and apply the correct pipe: (something like that)
<li *ngFor="let item of values"> {{item.value | item.pipe}} </li>
I tried to build a class:
export class FacetConfiguration {
value: string;
pipe: Pipe;
}
and I inject an object of the pipe to the class. but it did not work.
is there such a way to do that? or another idea?
P.S. the reason while I am doing that is that I have a huge list of configurations and each one of them has a different pipe type, so hard coded will be kind of hard.
thank you