As the title says, how would I go about using a for loop in my route to check to go through all the data in my controller?
It is not 100% clear to me but you can pass your model to a component and loop over it there with forEach like this:
enrichedContent: function() {
var content = [];
var sum = 0;
this.get('filteredContent').forEach(function(item) {
var total = 0;
var available = item.get('available');
if (available > 0) {
total = item.get('worth') * available;
}
sum = sum + total;
item.set('total', total);
content.push(item);
});
var item = Ember.Object.create({
sum: 1,
type: '',
available: '',
inorder: '',
total: sum
});
content.push(item);
return content;
}.property('filteredContent.@each.available', 'filteredContent.@each.worth')