I am developing job form which contains job related fields and some of the fields have more than 5 validation.
Here is my Html Code:
<div [formGroup]="jobForm">
<div>
<input type="text" formControlName="userName"/>
<div *ngIf="jobForm.controls.userName.errors && jobForm.controls.userName.errors.required"
class="alert alert-danger">
Required....
</div>
<div *ngIf="jobForm.controls.userName.errors && jobForm.controls.userName.errors.maxLength"
class="alert alert-danger">
max length 10
</div>
<div *ngIf="jobForm.controls.userName.errors && jobForm.controls.userName.errors.exits"
class="alert alert-danger">
user is already exits
</div>
<div *ngIf="jobForm.controls.userName.errors && jobForm.controls.userName.errors.shouldNotSameAsName"
class="alert alert-danger">
Should Not Same as name.
</div>
<div *ngIf="jobForm.controls.userName.errors && jobForm.controls.userName.errors.minLength"
class="alert alert-danger">
minimum length is 5
</div>
</div>
In my job form there are more than 15 fields in one wizard, It is bit difficult to manage the code on HTML side with *ngIf conditions. How can I overcome this problem?
See the below link, which is little bit same as mine but it is not marked as answer and not found any documentation on the provided answer.
Thanks in advance.