ng-bootstrap-form-validation icon indicating copy to clipboard operation
ng-bootstrap-form-validation copied to clipboard

BUG: Async Validators Prevent Submit

Open IdanCo opened this issue 7 years ago • 2 comments

The validSubmit attribute of FormValidationDirective is emitted based on FormGroup's current status, as shown here -

if (this.formGroup.valid) {
      this.validSubmit.emit(this.formGroup.value);
    }

So if we're using an async validator, this condition will be false until async validation is resolved.

PR coming up...

IdanCo avatar Oct 24 '18 21:10 IdanCo

OK, my original approach proved wrong.

the statusChanges observable is misbehaving and can't be trusted: When status is pending, no further events are emitted until another validation is triggered, not sure why.

So I simply skipped the second validation in case an async validation is present.

PR updated accordingly.

IdanCo avatar Oct 25 '18 22:10 IdanCo

See #24

ONbik-srebollo avatar Oct 31 '18 08:10 ONbik-srebollo