mercredi 18 février 2015

Ember - this.get(one from an array)

So I've got two versions of this question, one a little simplified, one a bit more like what I'm trying to achieve.



  1. I have a "student" model and a "score" model. The "student" has many "scores". On the "student" controller, I'm trying to set a computed property "score" equal to a specified one of these "scores".


Is there some way I can pass in another argument (eg, so as return the first in the array)?


In controllers/student



score: function(){
return this.get('scores', 1);
}.property('scores')



  1. An extra dimension here. The "score" model also belongs To an "objective" model. Can I set the "score" property on my "student" controller depending on the id of a chosen objective?


Aucun commentaire:

Enregistrer un commentaire