S
S
Serg Sniffer2016-12-27 14:43:37
Angular
Serg Sniffer, 2016-12-27 14:43:37

How to apply default pipes dynamically?

The task is following:
There is an array of objects. Each object has a pipe: string field. For example, { name: 'Test', pipe: 'lowercase' }.
In view, I display a list of objects and I want the pipe that is specified in the object to be applied to each object.

<span *ngFor="let item of items">{{ item.name | item.pipe }}</span>

As a pipe, I plan to use only default ones, custom pipes are not needed.
Is it possible to implement this? What is the best way to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Kupstas, 2016-12-28
@sniffer

This is unlikely to happen, because Angular makes binds at the compilation stage. In theory, he should generally give an error on this. So the easiest way is to inject pipes into a component and apply them right there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question