-
Notifications
You must be signed in to change notification settings - Fork 27.1k
FormResetEvent is not emitted via AbstractControl.reset() #58894
Copy link
Copy link
Closed
Labels
Milestone
Description
Which @angular/* package(s) are the source of the bug?
forms
Is this a regression?
No
Description
While working with forms, I was trying to subscribe to the FormResetEvent on AbstractControl.events and adding some special logic for when a form is reset (by the user or programatically with new initial values). Surprisingly the event is never emitted when using AbstractControl.reset(), but only when a <input type="reset"> button is clicked.
Here are some screenshots from the StackBlitz linked below:

As you can see the FormResetEvent is only emitted by the second form:

Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/stackblitz-starters-y6dgmq?file=src%2Fmain.ts
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run ng version)
Angular CLI: 18.2.12
Node: 22.11.0
Package Manager: npm 10.9.0
OS: linux x64
Angular: 18.2.12
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1802.12
@angular-devkit/build-angular 18.2.12
@angular-devkit/core 18.2.12
@angular-devkit/schematics 18.2.12
@angular/cdk 18.2.14
@schematics/angular 18.2.12
ng-packagr 18.2.1
rxjs 7.8.1
typescript 5.5.4
zone.js 0.14.10
But also happens with Angular 19 (see StackBlitz)
Anything else?
No response
Reactions are currently unavailable