sweetalert2angular-fontawesome

Is it possible to use an angular-fontawesome icon in sweetalert2 title?


Is it possible to use an angular-fontawesome icon inside a sweetalert2 title? I tried this but it doesn't work, the icon doesn't show and the inspector show size 0x0. I tried overriding the styles but I'm not very good with CSS.

swal.fire({
       title:  "<fa-icon [icon]="faBug" [border]="true" size="6x"></fa-icon>"

Solution

  • Please refer to the official documentation to learn how to pass icon to an arbitrary JavaScript library and why what you have attempted to do does not work.

    Below is an example from there:

    import { icon } from '@fortawesome/fontawesome-svg-core';
    import { faChevronLeft, faChevronRight } from '@fortawesome/free-solid-svg-icons';
    
    myTooltipLib({
        content: `<p><b>Hint:</b> You can navigate items with ${icon(faChevronLeft).html.join('')} and ${icon(faChevronRight).html.join('')} buttons.</p>`
    })