0
我試圖在ng-options
中插入HTML標籤,所以當文檔呈現的選項在文本前有圖標時。在ng選項中插入HTML標籤
HTML:
<select chosen id="receive-country-selection" ng-model="current.RecipientCountry" ng-change="selectRecipientCountry(current.RecipientCountry)" ng-options="x.Name.toLowerCase() for x in data.RecipientCountries" >
<option value=""></option>
</select>
需要渲染成類似:
<select chosen id="receive-country-selection" ng-model="current.RecipientCountry" ng-change="selectRecipientCountry(current.RecipientCountry)" ng-options="x.Name.toLowerCase() for x in data.RecipientCountries" >
<option>
<span class="flag-sprite-container">
<svg class="flag-sprite">
<use xlink:href="someUrl"></use>
</svg>
</span>
some text
</option>
</select>
我想知道,如果有一個非jQuery的選項來做到這一點。
附加信息:我正在使用jQuery Chosen將select
複製到ul
和option
到li
。
jQuery Chosen實際上將選項標籤轉換爲下劃線列表項目,所以這部分是爲什麼我使用它 –