I wanted to use Font Awesome 5+ and most answers focus on older versions
For the new Font Awesome 5+ the angular project hasn't been released yet, so if you want to make use of the examples mentioned on the font awesome website atm you need to use a work around. (especially the fas, far classes instead of the fa class)
I've just imported the cdn to Font Awesome 5 in my styles.css. Just added this in case it helps someone find the answer quicker than I did :-)
If for some reason you cant install package throw npm. You can always edit index.html and add font awesome CSS in the head. And then just used it in the project.
Font Awesome gives you scalablevector icons that can instantly be customized—size, color, drop shadow, and anything that can be done with the power of CSS.
Create a new project and navigate into the project.
ng new navaApp
cd navaApp
Install the font-awesome library and add the dependency to package.json.
You can use Angular Font Awesome package
and then import in your module:
and import the style in angular-cli file:
see more details about the package in npm library:
and then use it like this:
<i class="fa fa-coffee"></i>
To use Font Awesome 5 in your Angular project, insert the code below in the of the src/index.html file.
Good luck!
I wanted to use Font Awesome 5+ and most answers focus on older versions
For the new Font Awesome 5+ the angular project hasn't been released yet, so if you want to make use of the examples mentioned on the font awesome website atm you need to use a work around. (especially the fas, far classes instead of the fa class)
I've just imported the cdn to Font Awesome 5 in my styles.css. Just added this in case it helps someone find the answer quicker than I did :-)
Code in Style.css
If for some reason you cant install package throw npm. You can always edit index.html and add font awesome CSS in the head. And then just used it in the project.
Font Awesome gives you
scalable
vector icons that can instantly be customized—size, color, drop shadow, and anything that can be done with the power ofCSS
.Create a new project and navigate into the project.
Install the font-awesome library and add the dependency to
package.json
.Using CSS
To add Font Awesome CSS icons to your app...
Using SASS
Create new project with SASS:
To use with existing project with
CSS
:Rename
src/styles.css
tosrc/styles.scss
Changeangular.json
to look forstyles.scss
instead ofcss
:Make sure to change
styles.css
tostyles.scss
.Create an empty file
_variables.scss
insrc/
.Add the following to
_variables.scss
:In
styles.scss
add the following:Starting from https://github.com/AngularClass/angular-starter, after having tested a lot of different configuration combination, here is what I did to get it working with AoT.
As already said many times, in my
app.component.scss
:Then in webpack.config.js (actually webpack.commong.js in the starter pack) :
In the plugins section:
In the rules section: