Ember.computed.map()

map (dependentKey, callback) Ember.ComputedPropertypublic

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

Returns an array mapped via the callback

The callback method you provide should have the following signature. item is the current item in the iteration. index is the integer index of the current item in the iteration.

function(item, index);

Example

let Hamster = Ember.Object.extend({
  excitingChores: Ember.computed.map('chores', function(chore, index) {
    return chore.toUpperCase() + '!';
  })
});

let hamster = Hamster.create({
  chores: ['clean', 'write more unit tests']
});

hamster.get('excitingChores'); // ['CLEAN!', 'WRITE MORE UNIT TESTS!']

Parameters:

dependentKey String
callback Function

Returns:

Ember.ComputedProperty
an array mapped via the callback
doc_EmberJs
2016-11-30 16:51:16
Comments
Leave a Comment

Please login to continue.