I am struggling with using a standard angular2 pipe in a non-standard way and I was wondering if there are any ways around it.
Assume I have a variable which its value equals the definition of a standard pipe, for example, the common "date:'medium'" pipe.
let a = "date:\':medium\'";
Now, somewhere in my html, I would like to be able to use this "a" variable the following way:
<p>{{myRecord.date | a}}</p>
And I want this "a" to have the same effect of the date pipe it contains. Is there any way to achieve this?
来源:https://stackoverflow.com/questions/43788650/using-pipe-name-as-a-variable-in-the-template-in-angular2