除了你的把手模板的问题 - {{view}}
不能用结束标签关闭,但{{#view}}{{/view}}
需要 - 你提供的代码工作正常。 multiple
是一个布尔值,因此所有评估为true
的值都将设置为true
。这就是为什么分配multiple
的原因。我也删除了prompt
,因为它混淆了多个选择。我想这是一个错误。见http://jsfiddle.net/pangratz666/p4QfQ/:
把手:
{{view Ember.Select
multiple="true"
contentBinding="App.viewPersonController"
selectionBinding="App.selectedPersonController.persons"
optionLabelPath="content.personName"
optionValuePath="content.id"}}
的JavaScript:
App.viewPersonController = Ember.ArrayProxy.create({
content: [{personName: 'Alf', id: 1}, {personName: 'Brian', id: 2}]
});
App.selectedPersonController = Ember.Object.create({
persons: []
});
在view
把手助手的注意事项:如果你通过{{view ClassName}}
指定视图你告诉把手可呈现特定视图ClassName
,其中模板在视图的类上被定义为templateName
或预编译为template
。
通过{{#view ClassName}} template instructions {{/view}}
声明一个视图,您正在为显式定义视图的模板。
感谢帮手澄清,并解决了问题 – user1338121 2012-04-23 08:14:39