简体   繁体   English

ember.js Ember.Select具有多个选项的值绑定

[英]ember.js Ember.Select value binding with multiple options

I am trying to create a multiple select input element in Ember, where the content is coming from a hash, containing the label, value and group for the different options. 我正在尝试在Ember中创建一个多选输入元素,其中的内容来自哈希,其中包含不同选项的标签,值和组。 This works fine, however I am not able to access the value binding. 这可以正常工作,但是我无法访问值绑定。

Here is the JSBin ; 这是JSBin ; after submitting the form, it logs the selectedField variable to the console which is always 'undefined'. 提交表单后,它将selectedField变量记录到始终为“未定义”的控制台。

I would like to implement the binding so that the initial contents of selectedField are preselected. 我想实现绑定,以便预先选择selectedField的初始内容。

Update: I now see that the value method is unsupported for multiple selections, but then how do I pre-select and retrieve the selections? 更新:现在,我发现多个选择不支持value方法,但是如何预选和检索选择呢?

解决:我需要通过“选择”绑定选择(请参见JSBin)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM