19

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

enter image description here

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

Shiv Gaurav
  • 418
  • 2
  • 4
  • 11

3 Answers3

36

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">

Fateme Fazli
  • 11,582
  • 2
  • 31
  • 48
10

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';
}
Saad Qamar
  • 1,039
  • 9
  • 9
  • It should just be `@ViewChild('stepper') stepper: MatHorizontalStepper;` and it works like a charm. – Urke Jul 04 '20 at 13:02
  • From another post (https://stackoverflow.com/questions/60876479/angular-9-remove-default-icon-create-on-angular-material-stepper): I did this (more type complete): `this.stepper._getIndicatorType = (): string => STEP_STATE.NUMBER;` – Russ Feb 08 '21 at 06:05
1

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;
}
Roman Patutin
  • 2,171
  • 4
  • 23
  • 27