Angular 4 - Conditional CSS Classes
You can do this using the class binding:
<input type="email" class="form-control" [class.error-field]="error">
yeah there's a better way using ngClass
attribute like this:
<input type="email" [ngClass]="{'form-control': true, 'error-field': error}" />