I am using Angular2 and its ngFor. I want to add class to odd and to even rows, so I can separate them visually by color.
Here is my code (which does not work really):
<div *ngFor="#meeting of meetingList; #index=index; #odd=odd; #even=even;"
class="row"
[ngClass]="{ odd: odd, even: even }
">
<div class="col"></div>
<div class="col"></div>
</div>
Although if I do it like this, code works:
<div *ngFor="#meeting of meetingList; #index=index; #odd=odd; #even=even;"
class="row"
">
<div class="col" [ngClass]="{ odd: odd, even: even }"></div>
<div class="col" [ngClass]="{ odd: odd, even: even }"></div>
</div>
Is there any better way to put class to row instead to columns? Thank you in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…