Skip to content

Conversation

@mmalerba
Copy link
Contributor

@mmalerba mmalerba commented Jan 28, 2026

Changes the submit function signature to accept a FormSubmitOptions object instead of a direct action callback.
This allows for more flexibility, including:

  • action: The standard submit action to perform with the data.
  • onInvalid: A callback to execute when the submit action is not triggered due to failing validation
  • ignoreValidators: Controls whether pending validators or invalid validators should be ignored

Also updates the return value of submit to a Promise<boolean to indicate submission success.

Updates FormOptions to accept a submission configuration object.
This allows defining default submit options (action, validation behavior, etc.)
when creating the form, which can be overridden when calling submit().

@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: forms labels Jan 28, 2026
@ngbot ngbot bot added this to the Backlog milestone Jan 28, 2026
@mmalerba mmalerba added the target: patch This PR is targeted for the next patch release label Jan 29, 2026
@mmalerba mmalerba marked this pull request as ready for review January 29, 2026 00:04
@pullapprove pullapprove bot requested review from crisbeto and devversion January 29, 2026 00:04
@mmalerba mmalerba requested review from alxhub, kirjs and leonsenft and removed request for crisbeto and devversion January 29, 2026 00:04
Changes the `submit` function signature to accept a `FormSubmitOptions` object instead of a direct action callback.
This allows for more flexibility, including:

- `action`: The standard submit action to perform with the data.
- `onInvalid`: A callback to execute when the submit action is not triggered due to failing validation
- `ignoreValidators`: Controls whether pending validators or invalid validators should be ignored

Also updates the return value of `submit` to a `Promise<boolean` to indicate submission success.
Updates FormOptions to accept a submission configuration object.
This allows defining default submit options (action, validation behavior, etc.)
when creating the form, which can be overridden when calling submit().
...(options ?? {}),
} as Partial<FormSubmitOptions<TModel>>);
const action = opts?.action;
if (!action) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I may have missed the discussion about this, but is the desire to support two ways of specifying the submit action worth the complexity/error here?

Did we consider only supporting it at the form() level? Is there are case where users would define the form() action, and override it with local submit() behavior?

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

Labels

area: forms detected: feature PR contains a feature commit target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants