-
Notifications
You must be signed in to change notification settings - Fork 27k
Description
Describe the problem that you experienced
In the in-depth guide about signal forms, in the validation section, the documentation for the required() validator states that A field is considered "empty" when the value is an empty array. But this does not seem to be the case when I have a signal form with a tag box widget having an array of string values as form model. An empty array does not fail the validation and passes instead.
Some issues inconsistency between "classic" and signal forms validators regarding empty arrays seem to suggest, that this is the expected behavior, which is not what the docs suggest.
Enter the URL of the topic with the problem
https://angular.dev/guide/forms/signals/validation#required)
Describe what you were looking for in the documentation
I was searching how to use the required validator in a signal form with a tag box that has an array of string values as model.
Describe the actions that led you to experience the problem
I was testing a signal form with a tag box widget having an array of string values as form model. An empty array does not fail the validation and passes instead.
Describe what you want to experience that would fix the problem
Either the documentation should be changed to not include the empty array as empty value for the required validator. Then it would be useful to document how to deal with required field that has an array as form model.
Or the code should implement the required validator according to the documentation.
Add a screenshot if that helps illustrate the problem
No response
If this problem caused an exception or error, please paste it here
If the problem is browser-specific, please specify the device, OS, browser, and version
Provide any additional information here in as much as detail as you can