Ember.js 1.0.0: Computed Property in Parent Controller Based on Child ItemController Property Not Updating -
i have alertscontroller has multiple alertcontroller children underneath it. when user clicks on alert set isselected flag true in alertcontroller alertview. have computed property in alertscontroller should return number of selected alerts.
the alertscontroller , alertcontroller this:
app.alertscontroller = ember.arraycontroller.extend({ itemcontroller: 'alert', //numselected doesn't update when isselected flag in alert changes numselected: function(){ return this.filterproperty('isselected', true).get('length'); }.property('@each.isselected') }); app.alertcontroller = ember.objectcontroller.extend({ isselected : false, });
i know isselected property in alertcontroller updating value numselected in alertscontroller computed once when page loads.
i recreated issue in following fiddle:
jsfiddle: http://jsfiddle.net/wlanf/8/
does know doing wrong here? thank assistance!
you should not define isselected
in app.alertcontroller
:
app.alertcontroller = ember.objectcontroller.extend({ // isselected : false, });
see working demo: http://jsfiddle.net/bqmww/1/
the reason that, if define isselected
explicitly in app.alertcontroller
, not available in proxied content
object (and therefore not accessible app.alertscontroller
).
Comments
Post a Comment