In this video, I'll show you how to implement form validation in Angular in two ways, one of them being the most known and the second being a more advanced use case.
Validation from outside is done passing ValidatorFns and AsyncValidatorFns to a FormControl. Validation from inside is done with the ControlValueAccessor, Validator, and AsyncValidator interfaces.
📚 Read the article: https://www.lucaspaganini.com/academy...
🚨 Subscribe to the newsletter: https://www.lucaspaganini.com/newsletter
📧 Email: [email protected]
🐦 Twitter: / lucaspaganini
📸 Instagram: / lucaspaganini
----------
CHAPTERS
0:00 Introduction
0:33 Angular Validators
0:55 Reactive vs Template
2:01 ValidatorFn
3:54 AsyncValidatorFn
5:26 Validator
8:36 AsyncValidator
9:13 Conclusion
REFERENCES
1. Repository: https://github.com/LucasPaganini/publ...
2. Part one, introduction to ControlValueAccessors: • Control Value Accessor: Custom Form C...
3. Pull request to make Angular forms strictly typed: https://github.com/angular/angular/pu...
4. Library for typed forms in the meantime: https://www.npmjs.com/package/ngx-for...
5. Article explaining how the typed forms library was created: https://indepth.dev/posts/1198/angula...
6. Angular form validation from outside: https://angular.io/guide/form-validation
7. Angular validation from inside: https://angular.io/api/forms/Validator
8. Angular async validation from inside: https://angular.io/api/forms/AsyncVal...