1@Component({
2 selector: 'app-your-component',
3 templateUrl: './your-component.component.html',,
4 host: {'class': 'your-class'}
5})
6export class YourComponent implements OnInit {
7...
8}
1type one
2
3[class.my-class]="step === 'step1'"
4type two
5
6[ngClass]="{'my-class': step === 'step1'}"
7and multiple option:
8
9[ngClass]="{'my-class': step === 'step1', 'my-class2':step === 'step2' }"
10type three
11
12[ngClass]="{1:'my-class1',2:'my-class2',3:'my-class4'}[step]"
13type four
14
15[ngClass]="(step=='step1')?'my-class1':'my-class2'"
16