首页 > 解决方案 > Fontawesome 图标未在 Angular 项目中显示

问题描述

我已经使用 npm 安装了 fontawesomenpm install --save font-awesome

然后我将 css 添加到我的 angular.json 中,如下所示:

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

然后我将它添加到我的 html 文件中:

<button type="button" class="btn btn-outline-primary">
    <i class="fa fa-arrow-left"></i>
  </button>

在我的网页上显示一个空按钮,我做错了什么?

标签: angularfont-awesome

解决方案


    You can give the address in the styles.scss instead of the address in the package
    this way should work

@import "~font-awesome/css/font-awesome.min.css";


推荐阅读