在循环中选择流星选择选项

问题描述:

流星选择标签动态如何选择。请帮助我。在循环中选择流星选择选项

{{#with api_method_data_chnage}} 
    <select id="result_type"> 
    <option value="{{ result_type }}"> {{ result_type }}</option> 
    </select> 
{{/with}} 

这里的答案:https://github.com/meteor/meteor/wiki/Using-Blaze#conditional-attributes-with-no-value-eg-checked-selected

<option value="{{ result_type }}" selected={{isSelected result_type}}> {{ result_type }}</option> 

现在你只需要创建帮助isSelected,并使其返回取决于如果该参数是选择了一个或不truefalse

+0

请提供示例。@ Peppe L-G – 2014-11-07 03:59:22

+0

value =“{{result_type}}”当我们在控制台中看到时也不会显示。请帮助我。 – 2014-11-07 06:06:04