我的应用程序中有一个 matStepper,它的 2 个第一步如下所示:
<mat-step [stepControl]="actionFormGroup">...</mat-step>
<mat-step [stepControl]="flightsFormGroup">
<form [formGroup]="flightsFormGroup">
<ng-template matStepLabel>Title</ng-template>
<div class="central" fxLayoutGap="20px">
<app-list-flights></app-list-flights>
<div dir="rtl">
<button mat-raised-button color="accent" (click)="checkValidation()">Next</button>
</div>
</div>
</form>
</mat-step>
<mat-step>...</mat-step>
在我的打字稿中,FormGroup 声明是这样的:
export class NewReqComponent implements OnInit {
actionFormGroup: FormGroup;
flightsFormGroup: FormGroup;
ngOnInit() {
this.actionFormGroup = this._formBuilder.group({
ctrl: ['', Validators.required]
});
this.flightsFormGroup = this._formBuilder.group({
ctrl: [false, Validators.requiredTrue]
});
}
}
我的表单控件“ctrl”被一些设置为真或假的方法修改。但是,即使是真的,我也无法进行下一步。在第一步中,我只有一个输入,它运行良好,只要字段被填满,我就可以进入下一步。
有谁知道问题出在哪里?