jeudi 26 mars 2015

observing property changes to an ObjectProxy in Ember

Following this tutorial on how to use checkboxes with ember: http://ift.tt/1H1gPOT.


Everything works great. Except now I'd like to listen for when the property 'checked' changes in the object. Here is my code:



someArray: Ember.computed 'proxiedCheckedItems.[]', ->
// should fire whenever an item is checked. But it does not.
console.debug("CD: detected change here")
// return some array

proxiedModel: Ember.computed.map 'someArray', (model) ->
Ember.ObjectProxy.create({
content: model,
checked: false
})

proxiedCheckedItems: Ember.computed.filterBy('proxiedModel', 'checked', true)


so, observing proxiedCheckedItems.[] is wrong. I've tried proxiedCheckedItems.@each and proxiedCheckedItems.checked. Nothing works. So how do you observe an array of ObjectProxy in Ember?





Aucun commentaire:

Enregistrer un commentaire