I have two inputs:
If I apply my custom validator on the first input, then I focus the second one and change the value - I want to force first inputs re-validation...
At the moment it only re-validates first input when I change the value... Any suggestions?
At the moment when I focus the first input I can access it's reference:
<input name="mEnd" class="form-control" [(ngModel)]="endDate" ... #endDateInput="ngModel" (focus)="clog(endDateInput)" >
I wonder can I trigger re-validation using the input formControl reference methods?
You can subscribe to value changes of a control or the whole form. updateValueAndValidity allows you to modify the value of one or more form controls and the flag allows you to specify if you want this to emit the value to valueChanges subscribers.
You can update the validity of a formControl
form.controls['myControl'].updateValueAndValidity();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With