I have an Ember.js ArrayController with a model of People. I'm trying to create a computed property that generates the average of people's weight. It seems like this should be fairly easy, but I'm stuck. Here's my code.
App.PeopleController = Ember.ArrayController.extend({
//each model in the array has a "weight" property
averageWeight: function() {
//I don't know what to do here
}.property('@each.weight')
});
Handlebars code.
{{#each controller}}
{{name}}
{{/each}}
Average weight: {{weight}}