FormArray length validation in NgxSubFormComponent doesn´t propagate validity
See original GitHub issueHi!, firstly thank you for making angular forms better.
I think I found a bug, please look at this stackblitz: https://stackblitz.com/edit/ngx-subform-array-validation
specifically at the child-form.component, I´m using a validation function to validate FormArray length.
protected getFormControls(): Controls<ChildForm> {
return {
values: new FormArray([], this.minLengthArray(3)),
};
}
minLengthArray(min: number) {
return (c: AbstractControl): { [key: string]: any } => {
if (c.value.length >= min)
return null;
return { 'minLengthArray': true };
}
}
When I delete an ítem from the array, the root form and subform should be in an invalid state, but the validation error is not propagating to the parent, only the subform is invalid
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:27 (14 by maintainers)
Top Results From Across the Web
How to Validate FormArray length in angular2 - Stack Overflow
I want to add validations to the place formArray, so i am adding minlength validation, but minlength validation is not working on formArray....
Read more >FormArray - Angular
Tracks the value and validity state of an array of FormControl ... set the value of a control that doesn't exist or if...
Read more >ReactiveForms, FormArrays and Custom Validators
Adding validations just in the template is hard to understand and maintain. In this post we will: Implement a ReactiveForm; Add and remove ......
Read more >Angular Reactive Forms: Tips and Tricks | by Netanel Basal
We can also apply this option to a formGroup or a formArray . ... In such a case we don't have to use...
Read more >A thorough exploration of Angular Forms - InDepth.Dev
A FormControl can be considered standalone if it does not belong to an ... (eg: min-max validator that makes sure that min control...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve got a bunch of work to focus on so not sure I’ll be able to before end of week
I do keep it in mind and will try to have a look worst case scenario during the weekend
PR s now available: https://github.com/cloudnc/ngx-sub-form/pull/263