angular run validation on other controls 1

angular run validation on other controls

this.myform.form.get('myfield').updateValueAndValidity();  //where myform: NgForm

Here is what the above code is Doing:
1. The first line is setting the value of the form control to the value of the input.
2. The second line is setting the value of the input to the value of the form control.
3. The third line is updating the validity of the form control.

The reason why we need to do all three of these things is because Angular doesn’t know that the value of the input has changed.

Similar Posts