【发布时间】:2020-08-03 06:55:08
【问题描述】:
我需要根据我的数组属性更改垫步图标(角度材料步进器)的背景颜色:etape.etat。
<div *ngFor="let etape of pro.etapes; let i=index">
<mat-step *ngIf="etape.etat == 1" style="background-color: yellow;">
<ng-template matStepLabel> {{ etape.nomEtape }} </ng-template>
</mat-step>
<mat-step *ngIf="etape.etat ==2" style="background-color: green;">
<ng-template matStepLabel> {{ etape.nomEtape }} </ng-template>
</mat-step>
<mat-step *ngIf="etape.etat ==2" style="background-color: red;">
<ng-template matStepLabel> {{ etape.nomEtape }} </ng-template>
</mat-step>
</div>
</mat-horizontal-stepper>
但是,背景颜色只能使用 :
::ng-deep .mat-step-header .mat-step-icon{
background-color: red;
}
是否有可能根据条件动态更改垫步图标颜色?
【问题讨论】: