gpt4 book ai didi

angular - 如何在 Material-2 步进器中将第二步设置为事件步?

转载 作者:太空狗 更新时间:2023-10-29 17:22:08 27 4
gpt4 key购买 nike

<mat-vertical-stepper>
<mat-step label="Agreement Preparation">
<p>Agreement preparion is intiated by our side </p>
</mat-step>
<mat-step label="Ready for Biometric" selected active>
<p>Agreement preparion is intiated by our side </p>

</mat-step>
<mat-step label="Document in Submission">
<p>Agreement preparion is intiated by our side </p>

</mat-step>

我试过设置为激活和选中,但它不起作用。

最佳答案

添加对步进器的引用,例如#stepper 并在 View 初始化后,将 stepperselectedIndex 设置为 1。

在您的模板中:

        <mat-vertical-stepper #stepper>
<mat-step label="Agreement Preparation">
<p>Agreement preparion is intiated by our side </p>
</mat-step>
<mat-step label="Ready for Biometric">
<p>Agreement preparion is intiated by our side </p>
</mat-step>
<mat-step label="Document in Submission">
<p>Agreement preparion is intiated by our side </p>
</mat-step>
</mat-vertical-stepper>

...并在您的 typescript 中:

    import { ViewChild, AfterViewInit } from '@angular/core';
import { MatStepper } from '@angular/material';

Component({
.....
})
export class ComponentClass implements AfterViewInit {
@ViewChild('stepper') stepper: MatStepper;

ngAfterViewInit() {
this.stepper.selectedIndex = 1;
}
}

链接到 StackBlitz demo .

关于angular - 如何在 Material-2 步进器中将第二步设置为事件步?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46772934/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com