Sample Code:
var Day = Ember.Object.extend({
date:null,
activities:null, // is set to an Em.ArrayProxy in instantiation
historicalSection:function(){
return this.get('activities').filterProperty('inHistoricalSection', true);
}.property('activities').cacheable()
});
When ‘activities’ is set to an ArrayProxy, ‘historicalSection’ computed property gets computed. However, when the ArrayProxy at ‘activities’ gets updated(i.e. its length changes), the ‘historicalSection’ property doesn’t update.
Any ideas why?
When you bind the computed property on
activites, it means that it will be updated when you set a new value foractivities, so at init time, and only when callingset('activities', newArrayProxy).You can use
activities.@eachoractivities.lengthas the bound property to observe the length changes