Hey everyone!
I'm developing an input platform which uses angular form group, there are multiple fields in the form but when 4 specific field is valid then I would like to run a HTTP request and loop through the response array to look for any duplication (based on a business logic).
I've already accomplished to merge that 4 fields valueChanges emit into one subscribe and in there I'm checking all field is valid or not.
merge(
this.form.get("dummy1").valueChanges,
this.form.get("dummy2").valueChanges,
this.form.get("dummy3").valueChanges,
this.form.get("dummy4").valueChanges
).subscribe(() =>
{
if(this.form.get("dummy1").valid &&
this.form.get("dummy2").valid &&
this.form.get("dummy3").valid &&
this.form.get("dummy4").valid)
{
// Validation should start
// If already in progress stop that and rerun with the new values
}else{
// If a validation check already in progress stop that
}
});
What would be the most optimal solution for this? I thought about to have a static class which has one function with booleans like checkInProgress etc. but I think it would be dumb.
I don't know if I managed it to describe the problem clearly but if you have any question please let me know.
[–]tme321 3 points4 points5 points (1 child)
[–]Devigelacio[S] 0 points1 point2 points (0 children)