Skip to content

cyrilletuzi/angular-signal-forms-submit-issue

Repository files navigation

AngularSignalFormsSubmitIssue

To reproduce the error

  • git clone https://github.com/cyrilletuzi/angular-signal-forms-submit-issue
  • cd angular-signal-forms-submit-issue
  • npm ci
  • npm start
  • launch http://localhost:4200 in browser and open the console
  • submit the form

How the repo was done

  • ng new
  • doing a basic signal forms:
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 {
    submit(this.form, () => Promise.resolve());
  }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors