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.
<div *ngFor="#meeting of meetingList; #index=index; #odd=odd; #even=even;" [class.odd]="odd" [class.even]="even" class="row">
– DudleydudsIs there any better way to put class to row instead to columns?
, what that does mean then? – Dudleyduds