如何在选择选项中添加字体真棒图标

时间:2018-01-29 19:16:40

标签: html5 angular typescript

我正在尝试在选择选项中添加fontawesome图标。

<select name="personList">
   <option *ngFor="let person of personList">{{person.name}}<i class="fa 
       fa-user" aria-hidden="true"></i></option>
</select>

1 个答案:

答案 0 :(得分:5)

  

选择选项中的图标

您无法在i代码中添加option代码。

相反,你可以在select to font awesome上设置字体系列:

select {
  font-family: 'FontAwesome'
}

然后使用您想要的图标的字符点,例如对于fa-userhttp://fontawesome.io/icon/user/):

<option>Hi, &#xf007;</option>
相关问题