Ember.computed.intersect()

intersect (propertyKey) Ember.ComputedPropertypublic

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

A computed property which returns a new array with all the duplicated elements from two or more dependent arrays.

Example

let obj = Ember.Object.extend({
  friendsInCommon: Ember.computed.intersect('adaFriends', 'charlesFriends')
}).create({
  adaFriends: ['Charles Babbage', 'John Hobhouse', 'William King', 'Mary Somerville'],
  charlesFriends: ['William King', 'Mary Somerville', 'Ada Lovelace', 'George Peacock']
});

obj.get('friendsInCommon'); // ['William King', 'Mary Somerville']

Parameters:

propertyKey String

Returns:

Ember.ComputedProperty
computes a new array with all the duplicated elements from the dependent arrays
doc_EmberJs
2016-11-30 16:51:15
Comments
Leave a Comment

Please login to continue.