Skip to content

Commit 38d16e1

Browse files
committed
add note on binding null signals to fields
1 parent f96a098 commit 38d16e1

File tree

1 file changed

+1
-1
lines changed
  • blog/refactoring-a-form-to-a-signal-form

1 file changed

+1
-1
lines changed

blog/refactoring-a-form-to-a-signal-form/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ This is done to prevent the browser's built-in validation from interfering with
523523
524524
Some extra thoughts while I was looking at the documentation and playing around with Signal Forms, but didn't fit in the previous sections.
525525
526-
- In the form model you can see that every field is initialized with a default value, and not with `null` or `undefined`. This is is done on purpose, because otherwise the signal definitions are harder to type correctly. This keeps accessing the field values simple and type-safe.
526+
- In the form model you can see that every field is initialized with a default value, and not with `null` or `undefined`. This is is done on purpose, because otherwise the signal definitions are harder to type correctly. It can also act finicky, while binding it to a field. This keeps accessing the field values simple and type-safe.
527527
- Instead of creating a custom validator, it's possible to use the `error` function to define a custom validation rule directly within the form definition. This can be useful in scenarios where the validation logic is simple and doesn't need to be reused elsewhere.
528528
529529
```ts [name=customer-form.component.ts] [source=https://github.com/timdeschryver/Sandbox/blob/main/Sandbox.AngularWorkspace/projects/sandbox-app/src/app/customer-management/customer-form/customer-form.ts]

0 commit comments

Comments
 (0)