I have an Ember.js ArrayController which is with people's models. I am trying to create a calculated property I am creating an average weight of people, it seems that it should be quite easy, but I am stuck. Here's my code.
App People Controller = Amber Array Controller Extension ({// "weight" property in the array in each model is average: function () {// I do not know what to do here} .property ('@ each. Weight')}); Handlab code. {{each controller}} {{name}} {{each}} average weight: {{weight}} Understand that for some reason you need to access the model data within the calculated property to use 'every content to' '.
averageview: function (val) {var weight = this.get ('content. @ Every.weight') toArray (); // This is the important part! Weight. ForEach (function (val)) {// calc average here} return average; } .property ('@ each.weight')
No comments:
Post a Comment