2017-09-27 28 views
0

我想写一个选择国家的下拉列表,是否有可能在国名旁边添加国家名? enter image description here角ng选项添加图标

<div class="chosen-input-group col-sm-10 "> 
     <select id="country_type" chosen data-placeholder="-- 國家 --" disable-search="false" 
       ng-options="country_.country_id as country_.name for country_ in vm.country_data" 
       ng-model="vm.item.country_id"> 
      <option value=""> -- 國家 --</option> 
     </select> 
    </div> 
+0

风格图像的选项是这an​​gularjs v1或角度v2 +? –

回答

2

你可以在选项标签使用NG-重复,然后根据你想要它

<select > 
    <option ng-repeat="country_ in vm.country_data" 
    value="country_.country_id" 
    style="background-image:url({{country_.name}}.png);"> 
    {{ country_.name }} 
    </option> 
</select>