I am developing reset password form, where I want to validate the password field with some validation. Validations are mentioned below:
- 1 Character Uppercase.
- 1 Character LowerCase.
- Minimum Length should be 8.
- Max Length of 10.
Here is my component code as per need.
this.userForm = this.appFormBuilder.group({
password:['',[Validators.pattern(/[a-z]/),Validators.pattern(/[A-Z]/), Validators.min(8),Validators.max(10)]]
})
I want to show error message of respective condition has been failed on UI, But I am getting pattern error object on UI. How can I show error message of respective condition failed. Here is my Html code:
<div [formGroup]="userForm">
<input type="text" formControlName="password" />
{{userForm.controls.password.errors | json}}
</div>