Guys could any one help me out.
Here is what I have,
Ember binding with only an hash
Here is the template,
<script type="text/x-handlebars">
{{#each Page.PageController.content.tasks}}
{{#view Page.PageView contentBinding="this"}}
{{#unless editing}}
<div>
<h2>{{title}}</h2> {{view Ember.Checkbox checkedBinding="editing"}}
</div>
{{/unless}}
{{#if editing}}
<div>
<h2>{{view Ember.TextField valueBinding="title"}}</h2>
{{view Ember.Checkbox checkedBinding="editing"}}
</div>
{{/if}}
{{/view}}
{{/each}}
</script>
And here is the js,
Page = Ember.Application.create();
Page.PageController = Ember.ObjectController.create({
content: {
tasks: [
{
title: 'Heading',
editing: false},
{
title: 'Heading',
editing: false}
]
}
});
Page.PageView = Ember.View.extend({
edit: function() {
var content = this.getPath('content');
content.set("editing", true);
}
});
The issue is that I can bind a boolean of a plain old hash with view Ember.Checkbox, but how can I do that with a link action?
You need to use
Ember Objectsinstead of plain hash for the bindings to work properly as in the above example you need to change your code as followsLet me know if this helps…
Update
Fiddle