Angular: How to conditionally apply a style by using Date Pipe in the condition?
问题 I have an array in my component.ts and I want to loop in it in my component.html then inside that array contain a date, so with data I want to run a condition, if that date is greater than the current date then apply a specific style, if not then apply another style. For example something like this: <div class="container"> <div *ngFor="let t of table; let i = index"> <div [ngStyle]="{'background-color': t.date > | t:today ? 'red' : 'green'}"> <ul class="otherStyle"> <li>{{t.name}}</li> <span>