Skip to content

feat(forms): addValidators #37412

Description

@indraraj26

馃殌 feature request

Relevant Package

This feature request is for @angular/forms

Description

It will append validation to current validation that are in formControl.

Problem

Suppose in ngOnInit You have Validators.required on control, later you want to add Validators.min(0)
So you will use setValidators(Validators.min(0)) then required is removed.
So now you will have to append both
setValidators([Validators.required, Validators.min(0)]);

Describe the solution you'd like

addValidators(newValidator: ValidatorFn | ValidatorFn[] | null): void;
This will be like Array.push()

Describe alternatives you've considered

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: formsfeatureLabel used to distinguish feature request from other issues

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions