I have Angular project with the following pattern with a file app.component.ts which is like as follows and I'm using angular validator version "@angular/forms": "^14.2.0" :
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
[
Validators.required,
Validators.pattern(/^[^+%{}~?^:#!|=*;,\[\]<>"'`\¿\-]*$/),
Validators.maxLength(64)
]
And my html file as app.component.html :
<form [formGroup]="myForm">
<label for="name">Name:</label>
<input type="text" id="name" formControlName="name" />
<div *ngIf="myForm.get('name')?.hasError('required')">
Name is required.
</div>
<div *ngIf="myForm.get('name')?.hasError('pattern')">
Invalid characters in the name.
</div>
<div *ngIf="myForm.get('name')?.hasError('maxlength')">
Name should not exceed 64 characters.
</div>
</form>
Kindly let me know why this pattern is not accepting x,f,b on production build while same is working on dev build for validator framework
Top comments (0)