Is it possible in Angular 2 to apply a pipe under condition? I would like to do something like:
{{ variable.text | (variable.value ? SomePipe : OtherPipe) }}
If not, what is the preferred way to achieve this effect?
Is it possible in Angular 2 to apply a pipe under condition? I would like to do something like:
{{ variable.text | (variable.value ? SomePipe : OtherPipe) }}
If not, what is the preferred way to achieve this effect?
Since such syntax isn't supported, I think that the only way to do that is to implement another pipe to handle the condition:
And use it this way:
See this plunkr: https://plnkr.co/edit/KPIA5ly515xZk4QZx4lp?p=preview.
You need to change the syntax a bit:
Plunker example