Function
setDiff (setAProperty, setBProperty) ComputedProperty public
Module:
@ember/object
Defined in packages/@ember/object/lib/computed/reduce_computed_macros.js:607
import { setDiff } from '@ember/object/computed'; |
- setAProperty
- String
- setBProperty
- String
- returns
- ComputedProperty
- computes a new array with all the items from the first dependent array that are not in the second dependent array
A computed property which returns a new array with all the properties from the first dependent array that are not in the second dependent array.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import { setDiff } from '@ember/object/computed'; import EmberObject from '@ember/object'; let Hamster = EmberObject.extend({ likes: ['banana', 'grape', 'kale'], wants: setDiff('likes', 'fruits') }); let hamster = Hamster.create({ fruits: [ 'grape', 'kale', ] }); hamster.get('wants'); // ['banana'] |