我有一个集合视图如下:
Ember.Widget.ParentView = Ember.CollectionView.extend({
content: ['childView1', 'childView2'],
fnameBinding: ChildView1.fname,
lnameBinding: ChildView1.lname,
ChildView1: Ember.View.extend({
templateName: 'ChildView1',
fname: 'David',
lname: 'Johnson',
}),
ChildView2: Ember.View.extend({
fnameBinding: '_parentView.fname',
lnameBinding: '_parentView.lname',
})
});
如果我想在 ChildView1.handlebar 中显示名称,我应该如何引用 fname?以下不起作用:
<script type="text/x-handlebars" name="ChildView1">
{{fname}}{{lname}}
</script>
谢谢你的帮助!