I have reactive form and don't want validation to be triggered until user really visits a field.
For example, this is a field:
<input type="text" [formControl]="customerNumber">
And this is the component:
customerNumber: FormControl = new FormControl(
null, {validators: [Validators.required]
});
As you see, its simple. The issue I have is that validation is triggered when the form is displayed and the input field gets ng-invalid class, even it is not touched.
I need validation to be triggered only after the user touches the field.
input.$touchedBut, I'm not familiar with Angular 2's syntax. It might be worth checking out the NG2 validation docs angular.io/guide/form-validation