0

i'm trying to get 2 object of a table.

var tab=[
{t:"t1",selected:true},
{t:"t2"},
{t:"t3",selected:false}];

Where selected is false or undefined.

With $filter('filter')(tab,{selected:"!"}||{selected:false});

I only get the object [{"t":"t2"}]

Is it possible to filter with an or operator with this filter?

1
  • 1
    Why don't you just do it before the filter and then pass it in?
    – Katana24
    Mar 15, 2016 at 9:41

1 Answer 1

1

You need to create your own filter for it:

.filter('myfilter', function() {
  return function(selected) {
    return selected === '!' || selected === false;
  };
});

Not the answer you're looking for? Browse other questions tagged or ask your own question.