I'm working in Angular 11 with FontAwesome, and there's a context where I'd like to specify an icon by specifying a class attribute on an html element, after the fashion of the vanilla font-awesome usage, instead of by specifying an [icon]
attribute. Is there a good way for me to do that in Angular, though?
This doesn't produce any visible icon:
<fa-icon class="fa fa-bars"></fa-icon>
But this does:
<fa-icon [icon]="['fas', 'bars']"></fa-icon>
I'd like to specify this as a class instead of with [icon]
because I have an ngRepeat
in which I need to vary the icon depending on a property of the repetition's item and set two classes on the element, varying by that same property. Is there some approach that would be best for my needs?