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实际上将选项标签转换为下划线列表项目,所以这部分是为什么我使用它 –