2014-11-06 90 views
0

流星選擇標籤動態如何選擇。請幫助我。在循環中選擇流星選擇選項

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

回答

0

這裏的答案: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