Reputation: 524
In my EmberJS application, there are use cases where I want to observe something like '@each.score.votes', to calculate 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' doesn't fire at all. See this http://jsfiddle.net/jqTRu/2/
Click 'Change Votes' to change votes, but total_votes is not re-computed. However, upon adding a person, it does fire.
Is this a bug, or is there a more sensible way to achieve what I intend? Thanks.
EDIT: Peter's pointed out that it's a bug. Christopher's fix works (as you can see here http://jsfiddle.net/kazim/jqTRu/3/).
Upvotes: 3
Views: 652
Reputation: 10562
This has to do with setting up a chained observer with '@each' in the path. Basically, what's happening is that you have a nested array situation, since '@each.property' is evaluated as an array.
'@[email protected]_other_property' should work.
Upvotes: 4
Reputation: 5056
According to https://github.com/emberjs/ember.js/issues/541 it's a bug.
Upvotes: 3