Use font awesome with angular2+ material

  • fennng 
npm install font-awesome --save

 
Then 
 
Import css from .angular-cli.json
 

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

 
Add the following style to style.css

 
.fontawesome {
    display: inline-block;
    font: normal normal normal 14px/1 FontAwesome;
    font-size: 24px;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    text-align: center;
}

use

<mat-icon color="primary" fontSet="fontawesome" fontIcon="fa-thumb-tack"></mat-icon>​

发表评论

您的电子邮箱地址不会被公开。