Assign classes conditionally in Angular2
You can bind your object to the [ngClass]
directive
<div [ngClass]="{'active': isActive, 'disabled': isDisabled}">
almost the same syntax as angular 1. just add the square brackets
Angular 2 provide some way to add class with the condition , this link is helpful
Angular 2 conditional class with *ngClass