Ember.computed.collect()

collect (dependentKey) Ember.ComputedPropertypublic

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

A computed property that returns the array of values for the provided dependent properties.

Example

let Hamster = Ember.Object.extend({
  clothes: Ember.computed.collect('hat', 'shirt')
});

let hamster = Hamster.create();

hamster.get('clothes'); // [null, null]
hamster.set('hat', 'Camp Hat');
hamster.set('shirt', 'Camp Shirt');
hamster.get('clothes'); // ['Camp Hat', 'Camp Shirt']

Parameters:

dependentKey String

Returns:

Ember.ComputedProperty
computed property which maps values of all passed in properties to an array.
doc_EmberJs
2016-11-30 16:51:12
Comments
Leave a Comment

Please login to continue.