任何人都可以帮助我。这就是我所拥有的, Ember 绑定只有一个哈希
这是模板,
<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>
这是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);
}
});
问题是我可以将普通旧哈希的布尔值与视图 Ember.Checkbox 绑定,但是如何通过链接操作来做到这一点?