📜  angualr 向组件添加类 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:51.992000             🧑  作者: Mango

代码示例2
type one

[class.my-class]="step === 'step1'"
type two

[ngClass]="{'my-class': step === 'step1'}"
and multiple option:

[ngClass]="{'my-class': step === 'step1', 'my-class2':step === 'step2' }"
type three

[ngClass]="{1:'my-class1',2:'my-class2',3:'my-class4'}[step]"
type four

[ngClass]="(step=='step1')?'my-class1':'my-class2'"