Font awesome icons not showing up in Angular 5

独自空忆成欢 提交于 2020-01-04 14:13:01

问题


I installed it according to the instructions. First I've typed

npm install --save font-awesome angular-font-awesome

And it installed everything correctly. Then I changed in .angular-cli.json to contain the css like so:

 "styles": [
    "styles.css",
    "../node_modules/font-awesome/css/font-awesome.min.css"
  ],

And when I type this in the html: <span class="fas fa-chevron-left"></span>

It does not show anything at all for it.

I don't have errors either but in sources I can't find anything related to font awesome.


回答1:


<i class="fa fa-chevron-left"></i>

Use this it will help you




回答2:


This may not be the correct fix, but i had to use this in index.html to get the icons working.

<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />

According to the documentation in npm, the above link is needed only if you are NOT using angular-cli



来源:https://stackoverflow.com/questions/49574228/font-awesome-icons-not-showing-up-in-angular-5

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