Reputation: 8888
In Angular2, I want to change the class of tr to 'success' if video.encodings.length>0. It seems the following does not work. The expression of ngClass can bind to data var?
<tr *ngFor="#video of _videos" [ngClass]="success : {{ video.encodings.length >0 }}">
</tr>
Upvotes: 0
Views: 239
Reputation: 658225
The syntax for ngClass
should be
<tr *ngFor="#video of _videos" [ngClass]="{success : video.encodings.length > 0 }">
Upvotes: 1