Quantcast
Viewing latest article 20
Browse Latest Browse All 26

Answer by Alireza for Angular: conditional class with *ngClass

That's the normal structure for ngClass is:

[ngClass]="{'classname' : condition}"

So in your case, just use it like this...

<ol class="breadcrumb"><li [ngClass]="{'active': step==='step1'}" (click)="step='step1'">Step1</li><li [ngClass]="{'active': step==='step2'}" (click)="step='step2'">Step2</li><li [ngClass]="{'active': step==='step3'}" (click)="step='step3'">Step3</li></ol>

Viewing latest article 20
Browse Latest Browse All 26

Trending Articles