angularjs filter return font awesome icon 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 fa-icon in angular
import { BrowserModule } from '@angular/platform-browser';import { NgModule } from '@angular/core'; import { AppComponent } from './app.component';import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; @NgModule({ imports: [ BrowserModule, FontAwesomeModule ], declarations: [AppComponent], bootstrap: [AppComponent]})export class AppModule { }