1

How to do this in angularjs ?

I have field value and is_first_filter(where true or false). Where is_first_filter is true I want filtered field value by firstCustomFilter.

I can do this.

<p>field | is_first_filter ? firstCustomFilter : secondCustomFilter</p>

But it gives an error, so how can I select a filter by expression ?

georgeawg
  • 48,608
  • 13
  • 72
  • 95
  • 2
    Please describe what you want to accomblish and how what behavior you expect. To keep it short: Please describe "this" in your first sentence – lynxSven Nov 13 '19 at 08:08

1 Answers1

0

One option would be to pass arguments to angular filter as described here

Another option would be with tenary operator

{{ is_first_filter ? (field  | firstCustomFilter ) : (field | secondCustomFilter) }}
Athanasios Kataras
  • 25,191
  • 4
  • 32
  • 61