-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Closed
Milestone
Description
Which @angular/* package(s) are the source of the bug?
forms
Is this a regression?
No
Description
I am experimenting with clearing a dependent field using signal forms. I have come across an issue where calling reset on the dependent field, the field is not reset with the value provided.
form = form(signal(defaultFormValue));
continentName = computed(() => this.form.continentName().value());
constructor() {
effect(() => {
this.continentName();
this.form.countryName().reset("");
});
}After getting feedback on this in the Angular discord, it was pointed out that the _reset function isn't accounting for falsy values like empty strings.
| if (value) { |
Thank you.
Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/stackblitz-starters-aptcun6k?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 : 21.0.2
Angular : 21.0.3
Node.js : 22.19.0
Package Manager : npm 10.9.3
Operating System : win32 x64
┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 21.0.2 │ 21.0.2 │
│ @angular/cli │ 21.0.2 │ 21.0.2 │
│ @angular/common │ 21.0.3 │ 21.0.3 │
│ @angular/compiler │ 21.0.3 │ 21.0.3 │
│ @angular/compiler-cli │ 21.0.3 │ 21.0.3 │
│ @angular/core │ 21.0.3 │ 21.0.3 │
│ @angular/forms │ 21.0.3 │ 21.0.3 │
│ @angular/platform-browser │ 21.0.3 │ 21.0.3 │
│ @angular/router │ 21.0.3 │ 21.0.3 │
│ rxjs │ 7.8.2 │ ^7.8.1 │
│ typescript │ 5.9.3 │ ^5.8.2 │
└───────────────────────────┴───────────────────┴───────────────────┘
Anything else?
No response
SkyZeroZx
Metadata
Metadata
Assignees
Type
Projects
Status
Done