Follow the below steps for adding Font Awesome to an Angular-2 app created using Angular CLI
- Goto the project directory and open Command in Windows / terminal in Mac
npm install font-awesome --save //in Windows
sudo npm install font-awesome --save //in Mac
- In project root folder, find and open the file ‘angular-cli.json’ in any editor
- Locate the styles[] array and add font-awesome references directory. like:
"apps": [
{
....
"styles": [
"../node_modules/font-awesome/css/font-awesome.css"
"styles.css"
],
...
}
] - Add some font-awesome icons in any component html file.
- Rerun the server by command
ng serve
as ‘angular-cli.json’ is not observed for changes.
- Awesome Icons will be visible now