我正在使用基于组件的 mat stepper 组件来显示线性过程。每个步骤都有自己的组件,如下所示
<mat-card>
<mat-horizontal-stepper [linear]="isLinear" labelPosition="bottom" #stepper>
<!-- Step-1 -->
<mat-step [stepControl]="firstFormGroup">
<ng-template matStepLabel>Select Items</ng-template>
<select-item-component>
<select-item-component>
<div class="mt-5">
<button mat-flat-button color="primary" matStepperNext>Next</button>
</div>
</mat-step>
<!-- Step-2 -->
<mat-step [stepControl]="firstFormGroup">
<ng-template matStepLabel>Add Quantity</ng-template>
<add-qty-component>
<add-qty-component>
<div class="mt-5">
<button mat-flat-button color="primary" matStepperNext>Next</button>
</div>
</mat-step>
<!-- Step-3 -->
<mat-step [stepControl]="firstFormGroup">
<ng-template matStepLabel>Conform</ng-template>
<conform-step-component>
<conform-step-component>
<div class="mt-5">
<button mat-flat-button color="primary" matStepperNext>Done</button>
</div>
</mat-step>
</mat-horizontal-stepper>
</mat-card>
步骤 1 显示项目的多选列表,并将所选项目列表传递到下一个步骤 2,并在步骤 2 中添加每个项目的数量。
如何在下一步单击从步骤 1 到步骤 2 传递所选项目并显示传递的项目以在步骤 2 中输入数量?
我创建了一个通用服务层来设置和获取选定的项目。ngOnInit
步骤 2 的组件试图从公共服务中获取所选列表,但问题是组件 2 在下次单击之前已经启动。
在步骤1中单击下一步后可以初始化或重新初始化第二个组件吗?
从步骤 1 移动后,如何在步骤 2 中显示所选项目列表?
对于上述情况,最好的方法是什么?
只是指向可以回答我的问题的任何参考的链接,就足够了。
谢谢你。