Angular:带* ngClass的条件类

我的Angular代码有什么问题?我正进入(状态:

Cannot read property 'remove' of undefined at BrowserDomAdapter.removeClass ...

的HTML

<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>
小宇宙Near2020/03/12 16:42:59

让我们说,YourCondition是您的条件或布尔值属性,然后执行以下操作

[class.yourClass]="YourCondition"