angularfont-facewebfont-loader

Use Font Loader in Angular


How do I use a font loader, such as WebFontLoader or FontFaceObserver, in Angular?

I'm not sure on what/where I need to import and how to use it in a component.


Solution

  • Do:
    npm install webfontloader

    Then in your component you can write like this:

    app.component.ts:

    import * as WebFont from 'webfontloader';
    // ...
    ngOnInit(){
      WebFont.load({/* your config...*/})
    }