You want to conditionally add a CSS class to a list item only if it is visible, and also only render visible items. Which is the best way to combine structural and attribute directives?
hard📝 component behavior Q8 of 15
Angular - Directives
You want to conditionally add a CSS class to a list item only if it is visible, and also only render visible items. Which is the best way to combine structural and attribute directives?
A<ng-container *ngFor="let item of items"><li *ngIf="item.visible" [ngClass]="{visible: item.visible}">{{item.name}}</li></ng-container>
B<li *ngFor="let item of items" [ngClass]="{visible: item.visible}" *ngIf="item.visible">{{item.name}}</li>
C<li *ngFor="let item of items" *ngIf="item.visible" [ngClass]="{visible: item.visible}">{{item.name}}</li>