1

I tried this, but it doesn't work:

{{!filterNameVar ? valueVar : valueVar | filterNameVar}}

I need it for my dataGrid, if I get a filterName from dataGrid settings for a column I should apply it. I know I can do this in controller, but so far trying to find a way do it inline in a template.

MaxNevermind
  • 2,390
  • 1
  • 20
  • 28

1 Answers1

1

Workaround

It seems you can't add a filter from a variable in an expression like this:

{{'20141212'|filterNameVariable}} 

My workaround:

{{'20141212'|proxyFilter:filterNameVariable}}

Filter proxy code:

app.filter(
    "proxyFilter",
    function($filter) {
        return function(value, filterName) {
            if (filterName=='myFilter1') {
                return $filter("myFilter1")(value);
            } else if (filterName=='myFilter2') {
                return $filter("myFilter2")(value);
            } else {
                return value;
            }
        };
    });
MaxNevermind
  • 2,390
  • 1
  • 20
  • 28