Ember.computed.filterBy()

filterBy (dependentKey, propertyKey, value) Ember.ComputedPropertypublic

Defined in packages/ember-runtime/lib/computed/reduce_computed_macros.js:291

Filters the array by the property and value

let Hamster = Ember.Object.extend({
  remainingChores: Ember.computed.filterBy('chores', 'done', false)
});

let hamster = Hamster.create({
  chores: [
    { name: 'cook', done: true },
    { name: 'clean', done: true },
    { name: 'write more unit tests', done: false }
  ]
});

hamster.get('remainingChores'); // [{ name: 'write more unit tests', done: false }]

Parameters:

dependentKey String
propertyKey String
value *

Returns:

Ember.ComputedProperty
the filtered array
doc_EmberJs
2016-11-30 16:51:14
Comments
Leave a Comment

Please login to continue.