我正在尝试创建一个简单的嵌套视图。“子”视图是 Ember.Select。“选择”参数需要来自父级,我无法让它工作。如何做到这一点?
<script type="text/x-handlebars" data-template-name="application">
{{view App.SelectView contentBindingForSelect="App.names"}}
</script>
<script type="text/x-handlebars" data-template-name="select-view">
<h1>In SelectView</h1>
{{view view.childSelectView contentBinding="view.contentBindingForSelect"}}
</script>
window.App = Ember.Application.create();
App.names = ["Yehuda", "Tom"];
App.ApplicationView = Ember.View.extend({
templateName: 'application',
});
App.SelectView = Ember.View.extend({
templateName: 'select-view',
childSelectView: Ember.Select
});
JSFiddle 示例:http: //jsfiddle.net/kRwcU/1/