Icons FontAwesome (Angular)

Aus Tutorials
Version vom 3. Februar 2019, 17:33 Uhr von Martin Kirner (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „== Installation == <pre> npm install font-awesome --save </pre> <pre> npm i --save @fortawesome/fontawesome-svg-core npm i --save @fortawesome/free-solid-svg…“)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

Installation

npm install font-awesome --save
npm i --save @fortawesome/fontawesome-svg-core
npm i --save @fortawesome/free-solid-svg-icons
npm i --save @fortawesome/angular-fontawesome
"styles": [
  ...
  "node_modules/font-awesome/css/font-awesome.min.css",
  ...
],

Verwendung

Im Modul:

...
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { library } from '@fortawesome/fontawesome-svg-core';
import { faCoffee } from '@fortawesome/free-solid-svg-icons';

@NgModule({
  ...,
  imports: [
    ...,
    FontAwesomeModule
  ],
  ...
})
export class AppModule {
  constructor() {
    /* Add an icon to the library for convenient access in other components */
    library.add(faCoffee);
  }
}

In der Komponente:

<fa-icon [icon]="['fas', 'coffee']"></fa-icon>

Links

https://github.com/FortAwesome/angular-fontawesome#usage

https://fontawesome.com/free

Links Installation

https://www.npmjs.com/package/@fortawesome/free-solid-svg-icons


Zurück zu Angular