<mat-horizontal-stepper [linear]="true">
<mat-step [stepControl]="firstFormGroup">
<-- Code for the first step. -->
</mat-step>
<mat-step [stepControl]="?????"><ng-template matStepLabel>Fill out your address</ng-template><form [formGroup]="secondFormGroup_1">
<mat-form-field>
<input matInput placeholder="Address" formControlName="secondCtrl" required>
</mat-form-field></form><form [formGroup]="secondFormGroup_2">
<mat-form-field *ngIf "VARAIBLE = 1">
<input matInput placeholder="Address" formControlName="secondCtrl2" required>
</mat-form-field></form>
<div>
<button mat-button matStepperPrevious>Back</button>
<button mat-button matStepperNext>Next</button>
</div>
</mat-step>
<mat-step>
<-- Code for the third Step -->
</mat-step>
</mat-horizontal-stepper>
[StepControl] = "secondFormGroup_2 && secondFormGroup_1 " ---> Only secondFormGroup_1 must be valid to continue. This is wrong.(
secondFormGroup_1 && variable = 0 ) || (
secondFormGroup_1 &&
secondFormGroup_2 && variable= 1)
"