Angular Form Validation - KARA ERICKSON
Why Stack Overflow recommends it
Stack Overflow users link it when answering Angular form validation questions, such as async validators, debouncing, and stopping validation after a required check fails, since the talk comes from the person who worked on @angular/forms.
Recommended by 2 people across 2 different months, 2017 to 2018.
What it is
A conference talk from ng-conf by Kara Erickson of the Angular core team on form validation in Angular. It covers how validators work in @angular/forms and what was planned for upcoming validation features.
What people said
Recommends Tiep Phan · 2017-04 · Stack Overflow · on “Angular 2+: Stop form validation after required validator fails”
Is there a better / less verbose / already built-in way to do this? for now, Angular Form does not support yet. create custom validator is great solution. future: yeap, it's coming, please watch this talk [this video]
Recommends Tomasz Kula · 2018-03 · Stack Overflow · on “validate name uniqueness then submit the name directly to the database”
What you are looking for is an async validator. Check out this video by Kara Erickson (angular core team member, responsible for @angular/forms) on angular form validation. Angular Form Validation - Kara Erickson [this video]
Cites Brenton · 2017-05 · Stack Overflow · on “How to trigger validation input after debounce time in Angular2?”
The official way of getting what you want is in upcoming features to form validation. [this video] However, you can manually debounce validation by subscribing to value changes, and setting your own error. testForm.controls['name'].valueChanges .do( res => { if (res) { this.testForm.controls['name'].setErrors({loading: true}); } } ) .debounceTime(500) .subscribe( res => { if (this.nameSub) { this.nameSub.unsubscribe(); this.nameSub = null; } this.nameSub = this.http.get(apiURL + 'exist/?name=' + res).subscribe( exists => { this.testForm.controls['name'].setErrors({nameExists: true}); this.nameSub.unsubscribe(); this.nameSub = null; }, error => { if (res) { this.testForm.controls['name'].setErrors