mapBy (dependentKey, propertyKey) Ember.ComputedPropertypublic
Returns an array mapped to the specified key.
let Person = Ember.Object.extend({
childAges: Ember.computed.mapBy('children', 'age')
});
let lordByron = Person.create({ children: [] });
lordByron.get('childAges'); // []
lordByron.get('children').pushObject({ name: 'Augusta Ada Byron', age: 7 });
lordByron.get('childAges'); // [7]
lordByron.get('children').pushObjects([{
name: 'Allegra Byron',
age: 5
}, {
name: 'Elizabeth Medora Leigh',
age: 8
}]);
lordByron.get('childAges'); // [7, 5, 8]
Parameters:
-
dependentKey
String -
propertyKey
String
Returns:
-
Ember.ComputedProperty - an array mapped to the specified key
Please login to continue.