Questions tagged [angular-validation]

Angular 2+ validation patterns, syntax and properties. Validation of forms, controls, models using various Angular 2+ validation directives.

Angular's built-in form properties are there to help us with client-side validation.

You can either:

425 questions
0
votes
2 answers

AngularJs validate input length for multiple lengths

I have an input that should validate only if input length is 11 or 14. Is there any way of achieve this without create a directive? There's one more thing: I'm using a mask that formats the input as this: (when 11) 000.000.000-00 (when…
tfuelber
  • 85
  • 1
  • 9
0
votes
1 answer

Passing data from a component to Material Dialog

I have been working around to pass the data from a component to Material dialog below is my code First Component html file
nethra gowda
  • 290
  • 1
  • 4
  • 23
0
votes
1 answer

Angular Validator document is not defined

I'm trying to validate that a string-input is a valid CSS color. So, I've got a custom validator in my Angular App (based on some tutorials and some validation suggestions found on SO): import { AbstractControl, ValidationErrors } from…
nGAGE
  • 177
  • 1
  • 11
0
votes
0 answers

Group validator not kicking in after Angular Reactive Form patchValue

I'm using mydatepicker with the following homemade helper class: import {AbstractControl, FormBuilder} from '@angular/forms'; export const dateRangeValidator = (control: AbstractControl): {[key: string]: boolean} => { const start =…
0
votes
1 answer

Updating validity on FormArray property after validity change

I am using angular 4 to create a custom validator in a reactive form on a FormArray item that is an array. It works on the initial load, however if i add an item to the array and then remove that item, the Validator.required validation is than not…
user1752532
0
votes
1 answer

Number field Required validation Not working : Angular2

I am working with angular 2.Required field validator for number field showing uncertain behaviour.In edit mode it show required field error even though it contains value. my html code:
user19041992
  • 133
  • 1
  • 5
  • 18
0
votes
1 answer

angular2 - FormGroup Validation not triggering

I have a FormGroup inside a form. I need to validate the FormGroup controls when I click the submit button, but it is not triggering. TransactionForm is the form and allocationForm is the FormGroup. I need to validate the FormGroup lone when…
0
votes
1 answer

angular component with multiple inputs and validation (required)

I want to create a custom component with multiple input controlls which I can use in other components forms including the validation. The only examples I could find show how to create a simple component with ONE input and a custom validator. But I…
squadwuschel
  • 3,328
  • 3
  • 34
  • 45
0
votes
1 answer

custom dropdown validation display issue-Angular2

I am using primeng dropdown..and used reactive form validation..Everything working fine but the way error message display is not proper validation message shows up on page load.since i written following code.any suggestion about my code? or other…
user19041992
  • 133
  • 1
  • 5
  • 18
0
votes
1 answer

Angular 2+ ReactiveForm Custom Validation Function Not Triggered

I'm building my FormGroup in the following manner: this.datesGroup = this.fb.group({ arrivalDate: [null, Validators.required], departureDate: [null, Validators.required] }, (fg: FormGroup) => { console.log('validate'); return…
Sammy
  • 3,395
  • 7
  • 49
  • 95
0
votes
1 answer

Angular: what does myForm.errors stand for?

I would like to get all errors from a form. I tried to use the live example that came with Angular documentation, and I modified it adding required to the first field: createForm() { this.heroForm = this.fb.group({ name: ['',…
smartmouse
  • 13,912
  • 34
  • 100
  • 166
0
votes
1 answer

Errors when I try to validate input in Angular2

I am trying to validate input
John Doe
  • 3,794
  • 9
  • 40
  • 72
0
votes
0 answers

How to validate the form using if condition with multiple errors in Angularjs?

I have a scenario,I have to validate the form on click of submit button,but I have a function with multiple error messages in a function using if condition.I have to display the respective error message below sign-in button. HTML:
anub
  • 527
  • 1
  • 4
  • 21
0
votes
1 answer

Validate set of radio buttons using AngularJS

my code looks like this:
Question 1
Bleble
  • 1
  • 1
0
votes
2 answers

Clearing Form Validation Error on Typing

Edit (May, 4 2017): After a lot of research, it's clear to me that this is not currently possible in a "native" way. See here: https://github.com/angular/angular/issues/7113 Original Post: Currently, the following code allows me to display a…
Sammy
  • 3,395
  • 7
  • 49
  • 95