DEV Community

Alverson Layne
Alverson Layne

Posted on

Answer: Linear mode is not working in mat-horizontal-stepper with separate components

You could access your child's components using @ViewChild and access the child's form from your parent's html, for example:

parent.component.html

 ...
 <mat-step [stepControl]="myChild.form">
       <my-child #myChild></my-child>
 </mat-step>
 ...

parent.component.ts

...
@ViewChild('myChild', { static: false }) myChild: MyChildComponent;
...

my-child.component.ts

...
public form: FormGroup;
...

my-child.component.html

<form [formGroup]="form">
   ...
</form>

NOTE: You…

Top comments (0)