-
Notifications
You must be signed in to change notification settings - Fork 26.6k
feat(forms): add experimental signal-based forms #63408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
CARETAKER NOTE: patch cl/799748224 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
34ae012
to
4fd8b0a
Compare
There was a problem hiding this 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
There was a problem hiding this 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
This commit introduces an experimental version of a new signal-based forms API for Angular. This new API aims to explore how signals can be leveraged to create a more declarative, intuitive, and reactive way of handling forms. The primary goals of this new signal-based approach are: * **Signal-centric Design:** Place signals at the core of the forms experience, enabling a truly reactive programming model for form state and logic. * **Declarative Logic:** Allow developers to define form behavior, such as validation and conditional fields, declaratively using TypeScript. This moves logic out of the template and into a typed, testable schema. * **Developer-Owned Data Model:** The library does not maintain a copy of data in a form model, but instead read and write it via a developer-provided `WritableSignal`, eliminating the need for applications to synchronize their data with the form system. * **Interoperability:** A key design goal is seamless interoperability with existing reactive forms, allowing for incremental adoption. * **Bridging Template and Reactive Forms:** This exploration hopes to close the gap between template and reactive forms, offering a unified and more powerful approach that combines the best aspects of both. This initial version of the experimental API includes the core building blocks, such as the `form()` function, `Field` and `FieldState` objects, and a `[control]` directive for binding to UI elements. It also introduces a schema-based system for defining validation, conditional logic, and other form behaviors. Note: This is an early, experimental API. It is not yet complete and is subject to change based on feedback and further exploration. Co-authored-by: Kirill Cherkashin <[email protected]> Co-authored-by: Alex Rickabaugh <[email protected]> Co-authored-by: Leon Senft <[email protected]> Co-authored-by: Dylan Hunn <[email protected]> Co-authored-by: Michael Small <[email protected]>
This PR was merged into the repository. The changes were merged into the following branches:
|
Awesome work, Angular team 🚀 Is there a quick start guide or some beginner docs I can check out? |
Excellent work! You've managed to address all the common form issues we faced before. I'm really excited to try this out. Thanks to the Angular team! 🔥 |
Thanks for your enthusiasm! We're still working on the docs 🙂 |
Awesome, meanwhile this could be helpful: https://medium.com/mustakbil/angular-signal-forms-deep-dive-build-smarter-forms-with-new-signal-forms-api-in-angular-21-1feb15a68403 |
This commit introduces an experimental version of a new signal-based forms API for Angular. This new API aims to explore how signals can be leveraged to create a more declarative, intuitive, and reactive way of handling forms.
The primary goals of this new signal-based approach are:
WritableSignal
, eliminating the need for applications to synchronize their data with the form system.This initial version of the experimental API includes the core building blocks, such as the
form()
function,Field
andFieldState
objects, and a[control]
directive for binding to UI elements. It also introduces a schema-based system for defining validation, conditional logic, and other form behaviors.Note: This is an early, experimental API. It is not yet complete and is subject to change based on feedback and further exploration.
Closes #63293