【发布时间】:2015-11-02 01:47:03
【问题描述】:
所以我有一个 Select2 表单:
<require from="./select2"></require>
<select select2="selected-values.two-way: selectedStuff" data-placeholder="Choose Stuff" multiple>
<option repeat.for="thing of stuff">${thing.id}</option>
</select>
我可以使用它访问selectedStuff,它是所选things 的ids 的数组。但是,我想获得things 本身的数组,而不是他们的ids。在我的用例中,从id 中查找thing 是不可行的。有什么方法可以将thing 对象绑定到<option> 元素,这样我就可以获得选定things 的数组,而不是选定thing.ids 的数组?
【问题讨论】:
标签: javascript jquery-select2 aurelia jquery-select2-4