Angular:我如何根据条件更改 Font Awesome 图标和文本

问题描述

component.html

<i [title]="CardData.quantity > 1 || _ShippingVariable > 1 ? CannotShip : FreeShipping" 
   [ngClass]="{'fa': true,'fa-youtube': socialMediaLink.socialMediaType === 'YOUTUBE',}">
</i>

ShippingVairable 来自 component.ts

所以我想要做的是 _ShippingVariable=0 然后我会得到“(CrossFontAwesomeIcon)CannotShip:It should be in red color”。 如果 _ShippingVariable=1 那么我会得到 (CheckFontAwesomeIcon)FreeShipping:It should be in green color"。

请提供任何可以清除 Angular NgClass 的资源材料或教程,因为我想根据条件动态更改 CSS。

提前问候

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)