In my controller, I have a filtered array like
filteredPosts: Ember.computed.filterBy('model', 'foo', 'bar')
Is it possible that filteredPosts does not filter anything at all. I need this in case a user doesn't want to apply a filter and just wants to see all of the posts.
Then don't use Ember.computed.filterBy
. If you don't want to filter use the array directly. Or to implement something like a wildcard build your own computed property:
filteredPosts: Ember.computed('model', 'bar', {
get() {
const filter = this.get('bar');
const model = this.get('model');
return filter === '*' ? model : model.filterBy('foo', bar);
}
})
Basically Ember.computed.filterBy
is just syntactic sugar around a few lines of code. If you want to modify this code, just write it yourself.