Many instructions above work, I suggest looking at those. However, something to note:
Using <i class="fas fa-coffee"></i>did not work in my project (new practice project only a week old) after installation and the sample icon here was also copied to the clipboard from Font Awesome within the past week.
This<i class="fa fa-coffee"></i>does work. If after installing Font Awesome on your project it isn't yet working, I suggest checking the class on your icon to remove the 's' to see if it works then.
This post describes how to integrate Fontawesome 5 into Angular 6 (Angular 5 and previous versions will also work, but then you have to adjust my writings)
Option 1: Add the css-Files
Pro: Every icon will be included
Contra: Every icon will be included (bigger app size because all fonts are included)
There are many good answers here. But if you tried all of them and still getting squares instead fontawesome icons, check your css rules. In my case I had the following rule:
Many instructions above work, I suggest looking at those. However, something to note:
Using
<i class="fas fa-coffee"></i>
did not work in my project (new practice project only a week old) after installation and the sample icon here was also copied to the clipboard from Font Awesome within the past week.This
<i class="fa fa-coffee"></i>
does work. If after installing Font Awesome on your project it isn't yet working, I suggest checking the class on your icon to remove the 's' to see if it works then.Add it in your package.json as "devDependencies" font-awesome : "version number"
Go to Command Prompt type npm command which you configured.
This post describes how to integrate Fontawesome 5 into Angular 6 (Angular 5 and previous versions will also work, but then you have to adjust my writings)
Option 1: Add the css-Files
Pro: Every icon will be included
Contra: Every icon will be included (bigger app size because all fonts are included)
Add the following package:
Afterwards add the following lines to your angular.json:
Option 2: Angular package
Pro: Smaller app size
Contra: You have to include every icon you want to use seperatly
Use the FontAwesome 5 Angular package:
Just follow their documentation to add the icons. They use the svg-icons, so you only have to add the svgs / icons, you really use.
There are many good answers here. But if you tried all of them and still getting squares instead fontawesome icons, check your css rules. In my case I had the following rule:
And it overrides fontawesome fonts. Just replacing
*
selector tobody
solved my problem:Thought I would throw in my resolution to this since font-awesome is now installed differently according to their documentation.
Why it is fortawesome now escapes me but thought I would stick with the most recent version rather than falling back to the old font-awesome.
Then I imported it into my scss
Hope this helps