how to add font awesome icons in angular code example
Example 1: font awesome angular
//install in your project directory
npm install --save @fortawesome/fontawesome-free
// in angular.json add in the 'build' section the following lines in 'styles' and 'scripts'
"styles": [
"node_modules/@fortawesome/fontawesome-free/css/all.css"
]
"scripts": [
"node_modules/@fortawesome/fontawesome-free/js/all.js"
]
//from now on, you can use fontawesome icons through the <i>
<i class='fab fa-facebook'></i>
Example 2: how to use the downloaded fontawsoem icons in angula
"apps": [
{
"root": "src",
"outDir": "dist",
....
"styles": [
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.css",
"../node_modules/font-awesome/css/font-awesome.css" // -here webpack will automatically build a link css element out of this!?
],
...
}
]
],
Example 3: how to get fas icons in angualr
import { library } from '@fortawesome/fontawesome-svg-core';
import { fas } from '@fortawesome/free-solid-svg-icons';
import { far } from '@fortawesome/free-regular-svg-icons';
library.add(fas, far);