Импортируйте следующие компоненты углового материала и используйте тот же код, что и у вас
Module.ts
import { MatStepperModule, MatInputModule, MatButtonModule, MatAutocompleteModule } from '@angular/material';
@NgModule({
imports: [
...
MatStepperModule,
MatInputModule,
MatButtonModule,
MatAutocompleteModule,
],...
HTML
<mat-horizontal-stepper [linear]="isLinear">
<mat-step [stepControl]="firstFormGroup">
<form [formGroup]="firstFormGroup">
<ng-template matStepLabel>Step 1</ng-template>
<button mat-button mat-raised-button color="primary" matStepperNext>Solve</button>
</form>
</mat-step>
<mat-step [stepControl]="secondFormGroup">
<form [formGroup]="secondFormGroup">
<ng-template matStepLabel>Step 2</ng-template>
<mat-form-field>
<input matInput placeholder="Any input" formControlName="secondCtrl" required>
</mat-form-field>
<button mat-button mat-raised-button color="primary" matStepperNext>Next</button>
<button mat-button mat-raised-button color="" matStepperPrevious>Back</button>
</form>
</mat-step>
<mat-step>
<ng-template matStepLabel icon>Done</ng-template>
You are now done.
<button mat-button mat-raised-button color="primary" >Done</button>
</mat-step>
</mat-horizontal-stepper>
Component.ts
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
....
export class ComponentStepper{
isLinear = true;
firstFormGroup: FormGroup;
secondFormGroup: FormGroup;
constructor(private _formBuilder: FormBuilder){}
ngOnInit() {
this.firstFormGroup = this._formBuilder.group({
});
this.secondFormGroup = this._formBuilder.group({
secondCtrl: ['', Validators.required]
});
}
}
Это полная демоверсия даже с валидациями FormGruop