Skip to content

Validators.minLength(x) doesn't work on FormArray #13089

@SanderHeling

Description

@SanderHeling
[x] bug report
[ ] feature request
[ ] support request

Current behavior
When adding Validators.minLength(x) to a FormArray it will not validate. The error also contains actualLength: 0 instead of the actual number of controls in the array.

The validator now only works onFormControl, see PR for the breaking change

Expected behavior
The validator should validate the number of controls in a FormArray. This works in Angular 2.0.2 and lower.

Minimal reproduction of the problem with instructions
http://plnkr.co/edit/bIVqpHvioZkjf9NEC7MB. The initial actualLength is 0 .When you add or remove a FormControl it will not change.

  • Angular version: Angular 2.1.0 and up
  • Browser: All
  • Language: All

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions