July 2017
Intermediate to advanced
454 pages
10h 1m
English
AngularJS provides the ng-class directive to include or exclude CSS classes. Similarly, Angular has the ngClass directive to apply or remove CSS classes based on the expression. Class binding is another better option provided by Angular to add or remove a CSS class.
AngularJS:
<div ng-class="{active: isActive}">
Angular:
<div [ngClass]="{active: isActive}">
<div [class.active]="isActive">
Notice the class binding applied to the second div in Angular.
Read now
Unlock full access