Skip to content

docs(forms): note angular signal forms support for helper and error text - #4893

Merged
ShaneK merged 1 commit into
feature-9.1from
FW-7897
Dec 3, 2026
Merged

ShaneK merged 1 commit into
feature-9.1from
FW-7897

Conversation

@ShaneK

@ShaneK ShaneK commented Nov 23, 2026

Copy link
Copy Markdown
Member

Problem

The helper and error text sections say Angular adds ion-invalid and ion-touched automatically through form validation, but they don't say whether that includes Angular's signal forms.

Fix

Starting in Ionic v9.1, the Angular value accessors keep those classes in sync for signal forms using [formField], so the input, checkbox and other form control pages now say so and link to Angular's signal forms guide.

Notes

This depends on the framework change in ionic-team/ionic-framework#31813, so it shouldn't merge before that does.

Input helper and error text preview

@ShaneK
ShaneK requested a review from a team as a code owner November 23, 2026 22:47
@ShaneK
ShaneK requested review from brandyscarney and removed request for a team November 23, 2026 22:47
@vercel

vercel Bot commented Nov 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ionic-docs Ready Ready Preview Nov 23, 2026 10:47pm UTC

Request Review

@thetaPC thetaPC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@brandyscarney
brandyscarney removed their request for review December 2, 2026 15:59
@ShaneK
ShaneK merged commit 499dd78 into feature-9.1 Dec 3, 2026
7 checks passed
@ShaneK
ShaneK deleted the FW-7897 branch December 3, 2026 14:53
ShaneK added a commit to ionic-team/ionic-framework that referenced this pull request Dec 3, 2026
Issue number: resolves #31405

---------

## What is the current behavior?

Currently, Ionic form controls bound with Angular signal forms
(`[formField]`) don't get `ion-touched`, `ion-invalid` and the other
status classes when the form state changes in code. Calling
`markAsTouched()` never shows the `errorText`, and a cross-field
validator never marks the other input invalid. Without
`provideSignalFormsConfig({ classes: NG_STATUS_CLASSES })` there are no
`ion-*` classes at all, because we copy them from Angular's `ng-*`
classes and only on our own blur and input events.

Reactive and template-driven forms have a related problem with async
validators. Angular re-runs validation with `emitEvent: false` when the
directive sets up, so a check that settles after that never emits
`statusChanges`, and the field stays on `ion-pending` instead of getting
`ion-valid` or `ion-invalid`. `ion-pending` also never gets removed once
it's added, on any path.

## What is the new behavior?

When the bound control has no `statusChanges`, which is the case for
signal forms, we now build the `ion-*` classes from the control's state
inside an `effect`, so they update whenever that state changes. The
checkbox and toggle `writeValue` overrides pass the control along too,
so they don't overwrite those classes. A field whose async validator is
still running gets `ion-pending`, matching Angular's own classes.

For reactive and template-driven forms, an `ngDoCheck` compares the
control's state on each change detection run and rebuilds the classes
from it when something changed, the same way Angular keeps its `ng-*`
classes up to date. `ion-pending` is now cleared along with the other
status classes.

## Does this introduce a breaking change?

- [ ] Yes
- [X] No

But it is a new feature, which is why it's pointed at `feature-9.1`

## Other information

Signal forms don't compile on Angular 18-20, so the test pages only
exist in the `ng22` and `ng22-zone` apps. Base now has an empty
`version-test.routes.ts` for `/lazy` and `/standalone` that those apps
override, and I added a note about it to `docs/angular/testing.md`. The
async validator test for reactive forms lives in base, so it runs on
every app.

The reactive async fix also applies to `main`, and we'll backport it
separately in FW-8003.

[Signal forms test
page](https://ionic-framework-git-fw-7897-ionic1.vercel.app/angular/standalone/version-test/signal-forms)

Relevant docs PR: ionic-team/ionic-docs#4893

This branch was successfully deployed

1 active deployment
Preview — 9707e212 Deployed Nov 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants