Back to Browse

#132 Creating a Custom Async Validator | Reactive Forms | A Complete Angular Course

7.6K views
Jan 9, 2024
15:48

In this lecture you will learn what is an async validator and how to create & use it on a reactive form. Creating an async validator is very similar to creating a sync validator. The only difference is that, async validator either returns a promise or an observable. Also remember that, angular does not provide any built in async validator. But it allows us to create an async validator. We use the async validator when we need to send an HTTP call to the server to check if the data is valid. Creating a Async Validator is simple as creating a function, which must obey the following rules: 1. The function must return either an observable or a promise 2. Return null for valid, or an ValidationErrorCode if the input is invalid Let's understand async validator with a simple example, in this lecture. YOU CAN DOWNLOAD THE STARTUP PROJECT FROM HERE: https://github.com/manojjha86/angular-16-complete-course/tree/main/13-angular-reactive-form/start YOU CAN DOWNLOAD THE FINAL PROJECT FROM HERE: https://github.com/manojjha86/angular-16-complete-course/tree/main/13-angular-reactive-form/final

Download

1 formats

Video Formats

360pmp424.5 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

#132 Creating a Custom Async Validator | Reactive Forms | A Complete Angular Course | NatokHD