FortAwesome / angular-fontawesome

Official Angular component for Font Awesome 5+
https://fontawesome.com
MIT License
1.47k stars 149 forks source link

How to use FaIconLicrary in standalone app #406

Closed pdsavard closed 1 year ago

pdsavard commented 1 year ago

Hi, I just start a new projet with the standalone way in angular 16. Normally I inject all my icon with the

` constructor(library: FaIconLibrary) {

    //FAS
    library.addIcons();
    //FAR
    library.addIcons();
    //FAL
    library.addIcons();
    //FAD
    library.addIcons(fadPhone);
    //FAB
    library.addIcons();

}`

in the app module. But not, with the standalone option How I can do the same in the app.config. ts ?

export const appConfig: ApplicationConfig = { providers: [provideRouter(routes), provideAnimations()] };

thanks

devoto13 commented 1 year ago

You can put this code in the AppComponent constructor or in the APP_INITIALIZER. The only important thing is that it runs before you attempt to render the icon.

pdsavard commented 1 year ago

I see, thanks!