Just like the even and odd functionality, there are also two other variables that can be used to identify the first and the last elements of the list:<tr *ngFor="let hero of heroes; let first = first; let last = last" [ngClass]="{ first: first, last: last }"> <td>{{hero.name}}</td> </tr> <table> <thead> <th>Name</th> </thead> <tbody> <tr class='first'> <td>Superman</td> </tr> ... <tr class='last'> <td>Flash</td> </tr> </tbody> </table> |
No comments:
Post a Comment