Reputation: 193
Why doesn't this checkedBinding on an Em.Checkbox work?
Here is a code snippet illustrating the problem:
With this template
{{#each person in people}}
<li>{{view Em.Checkbox checkedBinding=person.isSelected}}</li>
{{/each}}
and this controller
App.IndexController = Em.Controller.extend({
count: function(){
return this.get('people').filterBy('isSelected').get('length');
}.property('[email protected]'),
people: Em.A([
Person.create({firstName: 'Kris', lastName: 'Selden', isSelected: true}),
Person.create({firstName: 'Luke', lastName: 'Melia', isSelected: false}),
Person.create({firstName: 'Formerly Alex', lastName: 'Matchneer', isSelected: false})
])
});
I see all the check boxes unchecked
Here is a fiddle.
Upvotes: 3
Views: 907
Reputation: 6709
You will need to wrap your checkedBinding
in quotation marks, like so:
{{#each person in people}}
<li>{{view Em.Checkbox checkedBinding="person.isSelected"}}</li>
{{/each}}
Upvotes: 3