On this page
Function
setDiff (setAProperty, setBProperty) Ember.ComputedProperty public
Module: | @ember/object |
---|
Defined in packages/ember-runtime/lib/computed/reduce_computed_macros.js:575
import { setDiff } from '@ember/object/computed';
- setAProperty
- String
- setBProperty
- String
- returns
- Ember.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
let Hamster = Ember.Object.extend({
likes: ['banana', 'grape', 'kale'],
wants: Ember.computed.setDiff('likes', 'fruits')
});
let hamster = Hamster.create({
fruits: [
'grape',
'kale',
]
});
hamster.get('wants'); // ['banana']
© 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/setDiff