因此,我必須修改一張墊卡以包含自定義文本和 3 個圖示之一(資訊、警告和危險,視情況而定)。我在 html 檔案中有這個:
<mat-card>
<mat-icon aria-hidden="false" aria-label="info icon" *ngFor="let icon">{{icon}}</mat-icon>
</mat-card>
在 .ts 檔案中,我不知道如何將卡片設定為特定圖示,因為字串不起作用。任何想法我怎么能做到這一點?如何分配特定圖示?
uj5u.com熱心網友回復:
我可以看到您有一個未完成的 *ngFor 陳述句。它應該是
*ngFor="let icon of someList"
或者也許你想做*ngIf="icon"
傳遞字串可能很好。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/452437.html
