You can configure the icon type with the ConfigModule. There are various ways to do so, I'm showing you an example with a so-called provider, but you can also use the ConfigModule or StorefrontModule to so.
providers: [
provideConfig({
icon: { symbols: { MIC: 'fas fa-microphone' } }
} as IconConfig)
]
Please not that I'm using the fontawesome version that has already been imported in Spartacus. If you switch to an alternative resource you must register the resource. You can read more about this at the documentation: https://sap.github.io/spartacus-docs/icon-library/
You can then use the new icon type in a component:
<cx-icon type="MIC"></cx-icon>
or as a directive:
<button cxIcon="MIC">I LIKE IT LOUD</button>
In order to use the icon directive, you need to import the IconModule
in the Angular module that host your component.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…