动态更改 <fa> 元素的名称
dynamically change name of <fa> element
我实际上正在尝试使用 angular-font-awesome (https://www.npmjs.com/package/angular-font-awesome) 在我的项目中添加图标。
我按照指南和页面中的示例安装了组件:
<fa name="cog" animation="spin"></fa>
工作正常。
我现在想动态更改名称。我试试这个
<label *ngFor="let icon of config.icons; let i = index" >
<fa name=[icon.name] animation="spin"></fa>
</label>
但它不起作用。知道如何实现吗?
使用以下任一方法。
<label *ngFor="let icon of config.icons">
<fa [name]="icon.name" animation="spin"></fa>
</label>
<label *ngFor="let icon of config.icons; let i = index" >
<fa name="{{icon.name}}" animation="spin"></fa>
</label>
我实际上正在尝试使用 angular-font-awesome (https://www.npmjs.com/package/angular-font-awesome) 在我的项目中添加图标。 我按照指南和页面中的示例安装了组件:
<fa name="cog" animation="spin"></fa>
工作正常。 我现在想动态更改名称。我试试这个
<label *ngFor="let icon of config.icons; let i = index" >
<fa name=[icon.name] animation="spin"></fa>
</label>
但它不起作用。知道如何实现吗?
使用以下任一方法。
<label *ngFor="let icon of config.icons">
<fa [name]="icon.name" animation="spin"></fa>
</label>
<label *ngFor="let icon of config.icons; let i = index" >
<fa name="{{icon.name}}" animation="spin"></fa>
</label>