我有“md-grid-list”来在网格中显示卡片。我正在使用“ngFor”循环我的数据数组。如何使用“ngIf”将数组中的每个日期时间元素与给定的日期时间进行比较?如果条件成功,则将卡片的颜色设置为绿色,如果条件不满足,则将卡片的颜色设置为不同的颜色。
<md-grid-list cols="4" rowHeight="250px" gutterSize="20px">
<md-grid-tile *ngFor="let data of mydata" >
<div *ngIf="(data.myDatetime | date:'HH:mm:ss, MMMM dd') < (myCurrentDateTime |date:'HH:mm:ss, MMMM dd')">
<md-card [style.background]="'red'" [style.minHeight]="'100%'">
<md-card-title></md-card-title>
<md-card-title></md-card-title>
<md-card-content>
<h2>
</h2>
</md-card-content>
</md-card>
</div>
</md-grid-tile>
</md-grid-list>