Ember.computed.setDiff()

setDiff (setAProperty, setBProperty) Ember.ComputedPropertypublic

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

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']

Parameters:

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
doc_EmberJs
2016-11-30 16:51:20
Comments
Leave a Comment

Please login to continue.