Skip to content

add casted control getters#36405

Description

@Toxicable

馃殌 feature request

Relevant Package

@angular/forms

Description

Currently get on AbstractControl returns an AbstractControl. This works as intended but dosen't play well with strictTemplates and deeply nested forms.

Describe the solution you'd like

add the methosd getGroup getControl getArray which will run the get function but then cast the type and do a runtime check to ensure it's the correct runtime type also.

Describe alternatives you've considered

Put a method in your component class, but this isn't ergonomic

asControl(c: AbstractControl): FormControl { return c as FormControl }

Happy to submit a patch

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: formscross-cutting: typesfeatureLabel used to distinguish feature request from other issuesforms: Controls APIIssues related to AbstractControl, FormControl, FormGroup, FormArray.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions