Elad Benda
Elad Benda

Reputation: 36674

how can I dynamically remove an error at the ng-stepper level?

I was trying to use this angular HTML

<mat-stepper #stepper>
  <mat-step [stepControl]="gadsForm" [attr.errorMessage]="showStepperError ? firstStepError : null">

But regardless of showStepperError's value - the stepper always shows an error.

enter image description here

Upvotes: 1

Views: 47

Answers (2)

Elad Benda
Elad Benda

Reputation: 36674

Adding [hasError] is the only thing that has worked for me:

<mat-step [stepControl]="gadsForm" [errorMessage]="stepperErrorMessage" [hasError]="stepperErrorMessage !== ''">

Upvotes: 0

Chellappan வ
Chellappan வ

Reputation: 27471

errorMessage is an input property for the mat-step component, not an attribute

Please change the errorMessage property as shown below:

<mat-step [stepControl]="gadsForm" [errorMessage]="showStepperError ? firstStepError : null">

Upvotes: 2

Related Questions