Add font-awesome icon to option in select [duplicate]

人走茶凉 提交于 2019-12-02 14:15:09

Since font-awesome icons are fonts, they can be added to options by Unicode:

<script src="//unpkg.com/angular/angular.js"></script>
<link rel="stylesheet" href="//unpkg.com/font-awesome/css/font-awesome.css">
  <body ng-app>
    <i class="fa fa-camera-retro"></i> fa-camera-retro<br>
    <select ng-model="choice" class="fa">
      <option value="">Choose</option>
      <option value="&#xf030; camera">&#xf030; camera</option>
      <option value="&#xf0f3; bell">&#xf0f3; bell</option>
      <option value="&#xf206; bicycle">&#xf206; bicycle</option>
    </select>
    <br>
    Choice = <span class="fa">{{choice}}</span>
    <br><span class="fa">&#xf030;-&#xf0f3;-&#xf206;</span>
  </body>

The DEMO on PLNKR

The Font-Awesome Cheatsheet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!