Function
filterBy (dependentKey, propertyKey, value) Ember.ComputedProperty public
Module: | @ember/object |
---|
Defined in packages/ember-runtime/lib/computed/reduce_computed_macros.js:333
import { filterBy } from '@ember/object/computed';
- dependentKey
- String
- propertyKey
- String
- value
- *
- returns
- Ember.ComputedProperty
- the filtered array
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 }]
© 2020 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://api.emberjs.com/ember/2.18/functions/@ember%2Fobject%2Fcomputed/filterBy