简体   繁体   English

如何使用角形材质步进器和角形6使上一步的selectedIndex步骤的所有步骤处于活动状态

[英]how to make active previous all steps of selectedIndex step using angular material stepper and angular 6

I have use angular material stepper and i need to activate all the previous steps till selectedIndex step in angular 6. I already tried by using linear stepper but i getting only active step for selectedIndex not for all previous index .Examble i have 5 steps and i select the 3rd one, I getting only 3 rd step in actively remaining 1st &2nd steps are inactive , I need to activate the 1st,2nd,3rd steps 我使用了角形材料步进器,我需要激活所有之前的步骤,直到在角度6中的selectedIndex步骤为止。我已经尝试过使用线性步进器,但是我只对selectedIndex而不是对所有先前的索引都使用了活动步进。选择第三个步骤,我在激活中仅获得第三步,其余的第一和第二步处于非活动状态,我需要激活第一,第二,第三步

angular 6 , angular material 6 角钢6,角钢6

in html 在HTML

<div class="col-lg-7" *ngIf="!process">
                           <mat-horizontal-stepper [linear]="isLinear" 
 [selectedIndex]="currentStep" #stepper>
                             <ng-container *ngFor="let step of steps">
                                   <ng-template matStepperIcon="home">
                                       <mat-icon>home</mat-icon>
                                     </ng-template>
                               <mat-step  [editable]="isEditable">
                                 <ng-template matStepLabel>{{step}}</ng- 
    template>
                               </mat-step>
                             </ng-container>
                           </mat-horizontal-stepper>
                         </div>  

in ts 在ts

```
isLinear = true;
      process: Boolean;
      steps = [ "Ordered", "Packed", "Shipped", 'Transit', "Delivered" ];
      this.process = true;
        setTimeout(() => {
          this.currentStep = 2;
          this.process = false;
        }, 1500);

I expected first three steps are active mode but i got only 3rd step in active mode

You can mark the steps that are before the selected step as completed: 您可以将所选步骤之前的步骤标记为已完成:

<mat-horizontal-stepper [linear]="isLinear" [selectedIndex]="currentStep" #stepper>
    <ng-container *ngFor="let step of steps; index as i">
        <ng-template matStepperIcon="home">
            <mat-icon>home</mat-icon>
        </ng-template>
        <mat-step #matStep [editable]="isEditable" 
                [completed]="matStep.interacted || i < currentStep">
            <ng-template matStepLabel>{{step}}</ng-template>
        </mat-step>
    </ng-container>
</mat-horizontal-stepper>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Angular Material Stepper Oninit 用于在 Step1 本身上调用的所有步骤 - Angular Material Stepper Oninit for all steps called on Step1 itself 如果在上一步中满足条件,如何跳过一个步骤 - Stepper | 角材料 - How to skip a step if a condition is met in a previous step - Stepper | Angular Material SelectedIndex 未在角度材料步进器中分配 - SelectedIndex is not assigned in angular material stepper Angular 2+ Material stepper:是否可以在材料步进器中打开所有步骤 - Angular 2+ Material stepper : Is it possible to open all steps in material stepper 如何使用Angular Material Stepper动态加载步骤 - How to load steps dynamically using Angular material stepper 使用 Angular 材料制作一个具有 24 个步骤的响应式步进器? 是否有任何替代的响应式步进器选项? - Make a responsive stepper with 24 steps using Angular material? Is there any alternate responsive stepper option for the same? 如何在 Angular Material Stepper 中禁用一个步骤? - How to disable a step in Angular Material Stepper? 角形材料 2 步进器 - 下一步 - Angular material 2 stepper - next step 如何使用角度和角度材料将步进器从一步移动到第二步 - How to move stepper from one step to second step using angular and angular material Angular Material Stepper 组件防止进入所有未访问的步骤 - Angular Material Stepper component prevent going to all the non visited steps
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM