Mat step show all steps

旧巷老猫 提交于 2020-01-16 10:09:10

问题


I was reading about mat-steps and wondering if it's possible to show all mat steps on the window.By default you have to click on the icon and then the corresponding steps appear.I want that all the steps are visible.Is it possible?Thanks in advance for the help.


回答1:


For vertical stepper, just add the following in your css file:

::ng-deep .mat-vertical-stepper-content 
{
    visibility: visible !important;
    height: 100% !important;
}



回答2:


By default you have to click on the icon and then the corresponding steps appear.I want that all the steps are visible.Is it possible?

If my understanding is correct you mean't steps are activated on click, but you want all of them enabled by default, if so !

CHECK WORKING STACKBLITZ

just set [completed]="true"

Your component.html can be something like this:~

<mat-horizontal-stepper [linear]="true" #stepper>
  <mat-step label="Step 1" [completed]="completed">
      <div class="page"></div>
  </mat-step>
  <mat-step label="Step 2" [completed]="completed">
      <div class="page"></div>
  </mat-step>
  <mat-step label="Step 3" [completed]="completed">
      <div class="page"></div>
  </mat-step>
</mat-horizontal-stepper>

Your component.ts like below:~

import { Component } from '@angular/core';
import { MatStepper } from '@angular/material';

@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.css' ]
})
export class AppComponent  {
  completed = true;
}


来源:https://stackoverflow.com/questions/55936566/mat-step-show-all-steps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!