我正在使用 angular mat-stepper。在我的示例中,我有 3 个步骤,我想设置第二个步骤。我正在使用selectedIndex
属性。
这是我的代码
<mat-stepper linear #stepper [selectedIndex]="selectedIndex">
<mat-step [stepControl]="firstFormGroup" >
<form [formGroup]="firstFormGroup">
...
</form>
</mat-step>
<mat-step [stepControl]="secondFormGroup" >
<form [formGroup]="secondFormGroup">
...
</form>
</mat-step>
<mat-step>
<div>
<button mat-button matStepperPrevious>Back</button>
<button mat-button (click)="stepper.reset()">Reset</button>
</div>
</mat-step>
</mat-stepper>
所选步骤正在显示,但问题是下一步按钮在步骤 2 中不起作用。当我单击下一步按钮时,没有任何反应。如果我转到上一步然后单击下一步按钮,它开始工作。为什么下一步按钮在步骤 2 中不起作用?我该如何解决?