I have a simple ArrayController which has the itemController attribute defined. I'd like to send an action from the ArrayController to each item's backing controller. I'm not sure how to "bubble down" this action though.
You can iterate over the controller itself and that returns the item controller.
App.IndexController = Em.ArrayController.extend({
itemController: 'foo',
actions:{
talkToChildren:function(){
this.forEach(function(itemController){
itemController.send('foo');
});
}
}
});
App.FooController = Em.ObjectController.extend({
count: 1,
actions:{
foo:function(){
this.incrementProperty('count');
}
}
})
http://emberjs.jsbin.com/fagosifu/1/edit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With