Reactive forms validation touched fires too early


#1

Hi, I am trying to do some nice validation for my forms. I am using reactive forms, and my code works as expected in an angular project. This is the (simplified) code:

<ion-label *ngIf=form.controls['email'].hasError('required') && form.controls['email'].touched"> You must include an email </ion-label>

The problem is that the touched event becomes true as soon as I write something in the input.

Can anyone advice on it?

Also, this topic was asked before here: Form Validation - FormControl touched being set immediately on focus


#2

Hi @seevoovapp, any news about this ? Same problem here …


#3

Not yet, unfortunately


#4

This issue is now solved.


#5

@jeba would probably appreciate some insight as to how the issue was solved


#6

I didn’t do anything to fix it, so I guess it was fixed in one of Angular’s or Ionic’s versions.


#7

Thx for the quote :slight_smile: