Skip to content

submit() + FormRoot throws NG01915 runtime error #67367

@cyrilletuzi

Description

@cyrilletuzi

Which @angular/* package(s) are the source of the bug?

forms

Is this a regression?

No

Description

Using submit() and [formRoot] in signal forms throws a runtime error:

import { Component, signal } from '@angular/core';
import { form, FormField, FormRoot, submit } from '@angular/forms/signals';

@Component({
  selector: 'app-root',
  imports: [FormRoot, FormField],
  template: `
    <form [formRoot]="form" (submit)="save()">
      <label>
        Name:
        <input type="text" [formField]="form.name" />
      </label>
      <button type="submit">Save</button>
    </form>
  `,
})
export class App {
  private readonly formModel = signal({ name: '' });
  protected readonly form = form(this.formModel);

  protected save(): void {
    // runtime error
    submit(this.form, () => Promise.resolve());
  }
}

results in runtime error:

ERROR RuntimeError: NG01915: Cannot submit form with no submit action. Specify the action when creating the form, or as an additional argument to `submit()`.

I indicated a repository with reproduction steps below.

It is because FormRoot calls submit() internally, without action (code here).

It means that if using manual submit(), it is not possible to use the benefits of FormRoot (novalidate + event.preventDefault()).

Proposed solution below in this comment.

Please provide a link to a minimal reproduction of the bug

https://github.com/cyrilletuzi/angular-signal-forms-submit-issue

Please provide the exception or error you saw

ERROR RuntimeError: NG01915: Cannot submit form with no submit action. Specify the action when creating the form, or as an additional argument to `submit()`.

Please provide the environment you discovered this bug in (run ng version)

Angular CLI       : 21.2.0
Angular           : 21.2.0
Node.js           : 24.14.0
Package Manager   : npm 11.11.0
Operating System  : darwin arm64

┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package                   │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build            │ 21.2.0            │ ^21.2.0           │
│ @angular/cli              │ 21.2.0            │ ^21.2.0           │
│ @angular/common           │ 21.2.0            │ ^21.2.0           │
│ @angular/compiler         │ 21.2.0            │ ^21.2.0           │
│ @angular/compiler-cli     │ 21.2.0            │ ^21.2.0           │
│ @angular/core             │ 21.2.0            │ ^21.2.0           │
│ @angular/forms            │ 21.2.0            │ ^21.2.0           │
│ @angular/platform-browser │ 21.2.0            │ ^21.2.0           │
│ @angular/router           │ 21.2.0            │ ^21.2.0           │
│ rxjs                      │ 7.8.2             │ ~7.8.0            │
│ typescript                │ 5.9.3             │ ~5.9.2            │
│ vitest                    │ 4.0.18            │ ^4.0.8            │
└───────────────────────────┴───────────────────┴───────────────────┘

Anything else?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions