Skip to content

feat(forms): add FieldState.getError()#67811

Open
alxhub wants to merge 1 commit intoangular:mainfrom
alxhub:sf/get-error
Open

feat(forms): add FieldState.getError()#67811
alxhub wants to merge 1 commit intoangular:mainfrom
alxhub:sf/get-error

Conversation

@alxhub
Copy link
Member

@alxhub alxhub commented Mar 23, 2026

Added a getError(kind: string) method to FieldState that returns the first validation error of a given kind, or undefined if no such error exists. This method is reactive and will re-evaluate when errors change.

Fixes #63905

Also updated public API goldens and added unit tests.

@pullapprove pullapprove bot requested review from AndrewKushnir and kirjs March 23, 2026 20:58
@alxhub alxhub added target: major This PR is targeted for the next major release forms: signals labels Mar 23, 2026
@angular-robot angular-robot bot added the detected: feature PR contains a feature commit label Mar 23, 2026
@alxhub alxhub added area: forms and removed detected: feature PR contains a feature commit labels Mar 23, 2026
@ngbot ngbot bot added this to the Backlog milestone Mar 23, 2026
Added a `getError(kind: string)` method to `FieldState` that returns the first validation error of a given kind, or `undefined` if no such error exists. This method is reactive and will re-evaluate when errors change.

Fixes angular#63905

Also updated public API goldens and added unit tests.
@angular-robot angular-robot bot added the detected: feature PR contains a feature commit label Mar 23, 2026
@AndrewKushnir AndrewKushnir removed their request for review March 23, 2026 22:30
@pullapprove pullapprove bot requested a review from AndrewKushnir March 23, 2026 22:30
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-for: public-api

@alxhub alxhub added action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note labels Mar 23, 2026
@alxhub
Copy link
Member Author

alxhub commented Mar 23, 2026

Caretaker: presubmit is "green"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: forms detected: feature PR contains a feature commit forms: signals merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: major This PR is targeted for the next major release

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Consider adding hasError function for signal forms

2 participants