top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

In Angular, How to identify odd rows and even rows in *ngFor repeater?

0 votes
199 views
In Angular, How to identify odd rows and even rows in *ngFor repeater?
posted Jan 26, 2018 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

*ngFor having flexibility to identify the odd or even rows.

Examples

<div *ngFor="let user of users; 
             let index =index;
             let isOdd=odd;
             let isEven=even" 

      [class.odd]="isOdd" 
      [class.even]="isEven" 
      [class.selected]="user=== selectedUser"> 
      <p>{{user.name}}</p>

</div>
answer Jan 31, 2018 by Aarati Mahajan
...