I'm using the official fontawesome library for Angular (8) and it seems that I can load the icons perfectly when statically naming the icon <fa-icon [icon]="faSearch"></fa-icon>
, but not when dinamically loading the same property as in <fa-icon [icon]="item.icon"></fa-icon>
, in which I'll get the following console error:
...
FontAwesome: Could not find icon with iconName=faSearch and prefix=fas. This warning will become a hard error in 0.6.0.
...
This happens to all icons looped, and strangely it interprets all of them as if they are coming from the "fas" (solid) library despite some belong to the "far" (regular) library, therefore the error is always displaying "prefix=fas".
I'm instancing the icons in the component as suggested by the documentation:
import { fas, faSearch, faGlobeEurope } from "@fortawesome/free-solid-svg-icons";
import { far, faFilePdf, faFilePowerpoint, faFileWord, faFileExcel } from "@fortawesome/free-regular-svg-icons";
export class HomeComponent implements OnInit {
constructor(...) { }
far = far;
fas = fas;
faFilePdf = faFilePdf;
faFilePowerpoint = faFilePowerpoint;
faFileWord = faFileWord;
faSearch = faSearch;
faFolder = faFolder;
faGlobeEurope = faGlobeEurope;
faFileExcel = faFileExcel;
...}
I've tried several options like but they don't seem to get around the issue.