I am utilizing the mat-stepper with a single form. My stepper has two steps only. I am looking to make an API request for every input value change, but only when the user is on the second step. How can I accomplish this?
.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();
});
}
In terms of HTML, I am following the same structure as outlined in the documentation.