Angular material stepper next step showing create instead of 1

家住魔仙堡 提交于 2020-08-24 05:56:12

问题


I am working on stepper, i want to disable next step until all filled should be filled so i made linear to true in html file

<mat-horizontal-stepper [linear]="true" #stepper>
        <mat-step [stepControl]="firstFormGroup">
          <form [formGroup]="firstFormGroup">

it's working fine but whenever i am going to next step, "1" becomes "cre" on inspecting i got

i didn't user create anywhere in my code it's coming from mat-icon


回答1:


you can set [completed]="false" on mat-step and you will have only numbers instead of icons.

or to replace the word "create" with the pen icon you need to add the google material font icon link:

<link href="https://fonts.googleapis.com/icon?family=Material+Icons"rel="stylesheet">




回答2:


add #stepper in mat-horizontal-stepper

<mat-horizontal-stepper [linear]="true" #stepper>
....
</mat-horizontal-stepper>

then in .ts file get that stepper

@ViewChild('stepper') stepper: MatHorizontalStepper;

and lastly, do it in afterViewInit

ngAfterViewInit() {
  this.stepper._getIndicatorType = () => 'number';
}



回答3:


Probably you use another font-family instead default. You can solve this issue with fix 'Material Icon' for font-family in pages that use the stepper.

:host /deep/ .material-icons {
  font-family: 'Material Icons' !important;
}


来源:https://stackoverflow.com/questions/51214275/angular-material-stepper-next-step-showing-create-instead-of-1

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