On the Angular Material stepper there is a stepControl
property on each mat-step
that contains a form. What does the stepControl
property do?
<mat-step [stepControl]="registrationForm">
It seems like the function would be to disallow moving to the next step if the form is not valid, but just wanted to double check.
CodePudding user response:
Correct, however, if any form validation is not compulsory you can use the isOptional
property to ignore that form's validity and proceed to the next step.
<mat-step [stepControl]="registrationForm" [optional]="isOptional">
Similarly if you are not using Reactive Forms you can use another property called completed
to allow the user to proceed to the next step only if completed is true
<mat-step [completed]="isCompleted">