EmberJS: Unable to observe @ each.property.another_property

There are cases in my EmberJS app where I want to observe something like "@ each.score.votes" to calculate the total votes or to return a sorted list, etc.

'@ each.score' is another Ember object.

However, any observer (or computed property) trying to observe "@ each.property.another_property" will fail at all. See http://jsfiddle.net/jqTRu/2/

Click Change Votes to change votes, but total_votes is not being recalculated. However, by adding a person, it works.

Is this a bug, or is there a smarter way to achieve what I intend? Thank.

EDIT : Peter pointed out that this is a bug. Christopher fixes things up (as you can see here http://jsfiddle.net/kazim/jqTRu/3/ ).

+3


source to share


2 answers


This has to do with setting up an anchored observer with "@each" in the path. Basically what happens is that you have a nested array situation, since '@ each.property' evaluates to an array.



'@ each.property. @ each.some_other_property 'should work.

+4


source


According to https://github.com/emberjs/ember.js/issues/541 this is a bug.



+3


source







All Articles