Questions tagged [angular-validator]
53 questions
0
votes
0 answers
Is there a way to convert subject subscription in a method to return a value
I'm developing an angular application, in which i have a modal dialog with a form with some fields. In one of that i have an async validator to check if a value is just present in the DB calling a BE api.
My need is to trigger validation when i…
![](../../users/profiles/698500.webp)
AngelPoyel
- 140
- 1
- 8
0
votes
2 answers
Angular Pattern Validation template driven form get validated elements from ngFor loop
I am working with Angular Pattern Validation template driven form for my Angular 9 project.
I have the list of properties which I need to validate in my form, so I am trying to put that html code in *ngFor loop to reduce my code:
0
votes
1 answer
Angular Reactive Form Control numeric and Alphabetic pattern validator Validation not Working
Am creating a custom reactive form from dynamic JSON value, trying to achieve hide the character what the user entered in text box to asterisk symbol,
Example: lets say user is typing "hello world".
Expected output: **********, this should come…
![](../../users/profiles/3147385.webp)
balajivaishnav
- 2,435
- 2
- 19
- 34
0
votes
0 answers
Angular Validator pattern not working as expected
I'm using angular reactive form. In a formControl of the formGroup I've set Validator.pattern with a Regex that's not working properly and I can't see why. I've validated the Regex on this site https://www.regextester.com/99144, to check it and it…
![](../../users/profiles/10978732.webp)
Wagner Vieira
- 109
- 1
- 9
0
votes
0 answers
Cannot read property 'invalid' of undefined
I keep getting this error and for the life of me, I don't know why! "Cannot read property 'invalid' of undefined" the changeData validator works, but the validator for the ChangePasswordForm form is not working.
0
votes
1 answer
Angular Validator that checks if an email is unique to a database set or the current email of a logged in user
In my current application I am trying to build a form that allows users to change their email or username. I have a validator on the form fields so users cannot have the same username or password as other users. I prefill the field with users'…
user12644181
0
votes
2 answers
Custom validator for date before in angular
I want to write a custom dateValidator with reactive forms to check if an inputed date is before today.
Component.html
0
votes
0 answers
Angular AsyncValidator does not work as I wanted
This is not my first time using AsyncValidator but this time I'm trying to create something more complicated. I am building a bank website. In my project, each user has multiple accounts.
I have two input areas in my form:
Input-1 takes the…
![](../../users/profiles/13120007.webp)
Adem Koksal
- 1
- 1
0
votes
0 answers
How to Add Custome Validation Message on Form Field in Angular
I want to add Range validation for date field which should work as form validation in Angular.
I am getting all validations for each field from API as below,
{
"name":"PolicyDateEnd",
"display":"Expiration Date",
"description":"Enter…
![](../../users/profiles/2088216.webp)
Keval Patel
- 747
- 3
- 19
- 44
0
votes
1 answer
Is there a way to access FormBuilder Validators in an Angular directive?
I've been trying to create a custom form validation directive in Angular 8 and I was wondering if it's possible to access the FormBuilder Validators attributes, such as, Required/minLength/maxLength inside my directive.
At the moment I'm handling…
![](../../users/profiles/12864637.webp)
ppanayiotou
- 50
- 7
0
votes
1 answer
error not display although old password and new password are same?
I work on angular 7
I compare between old password and new password
if two both are same then error must display
but in my case old password and new password are same but error not display
why error not display and How to solve this problem…
![](../../users/profiles/12573767.webp)
ahmed barbary
- 379
- 2
- 9
0
votes
1 answer
Angular 6 Input validator for 4 characters that can be combined?
I have an input for 4 characters A, B, M, N . the user can enter any of these values (at least 1 and max 4, no repeated). I need a validator in case the user enter another value e.g: P or Z.
The user can combine these characters e.g. A , BM, NA,…
![](../../users/profiles/6665356.webp)
matQ
- 537
- 9
- 24
0
votes
1 answer
Create a custom validator to validate against multiple form fields
I have the following form setup:
this.form = new FormGroup({
...
year: new FormControl("", validateDateMethod(year, month, day)),
month: new FormControl("", validateDateMethod(year, month, day)),
day: new FormControl("",…
![](../../users/profiles/1131657.webp)
Sun
- 3,743
- 12
- 50
- 91
0
votes
0 answers
How to reapply validators to formControl having same name
We have a form that have same formControlName for two fields. Only one field is visible at a time and validators are applied by below logic -
let validators: ValidatorFnUtil[] = [];
…
![](../../users/profiles/2586617.webp)
Narendra Pandey
- 369
- 1
- 8
- 25
0
votes
1 answer
Show form error without field blur in angular
In my application, I am trying angular validator. If the form is already filled with data, then the validation is perfect. But if no data is filled initially and if I click on the button, then it is not showing the errors. But if I click on some…
![](../../users/profiles/3378245.webp)
Arun
- 3,316
- 6
- 33
- 71