Angular #68 - Reactive Form (How to use Validator in Form Group instead to use in Form Control)

Опубликовано: 09 Октябрь 2024
на канале: Let's Build With Code
51
2

Click to watch Angular Playlist:    • Angular  

To view the code of this tutorial. Please visit this Github link: https://github.com/lets-build-with-co...
Note : Switch the particular branch of the tutorials of Github

To download my git repo of JSON Server & use it in you local for practice, Please visit this link: https://github.com/lets-build-with-co...

Reactive Form in Angular - use Validator in Form Group instead to use in Form Control

To use Validator in Form Group, first we will create FormGroup passwordMatched in the last we add passwordMatchValidator.

In previous example’s we are using validators directly on the form control itself but in this tutorial we are going to use validator directly on the from group.

Here in the example we need to add common validator for multiple controls. In the below syntax we have two control which we added in one common group and added the validator to achieve functionality.