I am using mat-stepper with single form. I have two steps only. I want to do API request on every input value change but only when the user is on the second step. how can I achieve that?
.ts
ngOnInit() {
this.formGroup = this._formBuilder.group({
formArray: this._formBuilder.array([
this._formBuilder.group({
"product": ['lifeci', Validators.required],
"gender": ['', Validators.required],
"birthDate": ['', [Validators.min(18), Validators.max(50)]],
"payFrequency": [12],
"subLimit": ['100']
}),
this._formBuilder.group({
"currency": ['USD', Validators.required],
"amount": ['15000', Validators.required],
"period": ['', Validators.required],
}),
])
});
//send request onchange
this.formGroup.valueChanges.subscribe(val => {
this.onSubmit();
});
}
for the HTML I am using the same structure as from documentation.