I have two forms on my page, and I want both of them to be valid before showing the save button. I was looking for something along the lines of:
combineSoonest([
this.nameForm.statusChanges,
this.addressForm.statusChanges,
]).pipe(
map(([nameStatus, addressStatus: [string, string]) => {
const nameIsValid = nameStatus === undefined || nameStatus === 'VALID';
const addressIsValid = addressStatus === undefined || addressStatus === 'VALID';
return nameIsValid && addressIsValid;
}),
).subscribe((isValid) => { this._showSaveButton(isValid); });
If I use the combineLatest
operator, nothing will be emitted until both forms have been touched. Is there a combineLatest
-like operator or option that allows me to emit even if one of the two combined observables has not emitted yet?