Angular 2 add multiple classes via [class.className] binding

You can do this by simply using ngClass :

Here first,second and third are the name of the classes.

And instead of true/false , you can directly put your conditions over there

 <div [ngClass]="{'first': true, 'second': true, 'third': false}">...</div>

In your case

 <div [ngClass]="{'loading-state': loading, 'my-class': loading }">...</div>

Or Shorter Veriosn (as @matko.kvesic commented)

<div [ngClass]="{'loading-state my-class': loading}">...</div>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)