Iterating over a collection with access to the index in Ember
// within your view/component
collectionWithIndices: function () {
return this.get('collection').map(function (item, idx) {
item.index = String(idx); // we need 0 to be "0" or Handlebars will consider it falsy
return item;
});
}.property('collection.@each'),