In Angular, is it possible to have a linear stepper where the individual steps are separate components? For example:
<mat-horizontal-stepper [linear]="isLinear">
<mat-step [stepControl]="firstFormGroup" label="Some Form">
<first-component></first-component>
</mat-step>
<mat-step [stepControl]="secondFormGroup" label="Another Form">
<second-component></second-component>
</mat-step>
<mat-step [stepControl]="thirdFormGroup" label="Review">
<third-component></third-component>
</mat-step>
</mat-horizontal-stepper>
When I try this, I receive the following error upon hitting the matStepperNext
button:
TypeError: Cannot read property 'invalid' of undefined
.
linear
propertymat-horizontal-stepper
isn't being enforced. It's allowing you to skip ahead to a subsequent step even though the form isn't valid. However, I suspect that if that weren't the case, you'd see the same issue (the error when hitting the Next button). Here's the example: stackblitz.com/edit/angular-fjhcgm – Charlsiecharlton