New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve documentation for boxed values in form control #36746
Comments
@matsko @kapunahelewong I can send a PR with an update on the But I wonder if there needs to be a previous confirmation of this change or it can be done right away? |
Thank you, @treeindev! I'd like confirmation on this, too. Let's see if @AndrewKushnir can give us some insight on this change. @AndrewKushnir, could you share your thoughts on this? |
Hi @jpchavat, thanks for creating this ticket. It looks like there are 2 parts that we need to look into:
Thank you. |
I think that this "value or boxed value" argument should be completely removed, it's only adding confusion. We should just have single argument containing everything: value, disabled, validators, asyncValidators, etc. Without the ability to pass the value directly. And to offer a "simple" way to instantiate these, we could add a static method to create from value. If new classes are added for type safety (see #38906), or even a new package, this could be easily done in the new classes and have the old ones deprecated. |
I agree, but unfortunately, that ship has long sailed. However, we are going to greatly improve the documentation when typed forms lands -- |
I'm submitting a ...
Current behavior ...
angular/packages/forms/src/form_builder.ts
Line 57 in acf6075
and
angular/packages/forms/src/form_builder.ts
Line 105 in acf6075
The documentation about the parameter
formState
in the methodcontrol(..)
and the parametercontrolsConfig
in the methodgroup(..)
(see line reference) doesn't explain very well how to set it. Additionally, the type hints has presence ofany
s and makes it harder to understand.Expected behavior
I propose the follow type hints changes to clarify the situation.
For the
formState
type hint:string | { value: string, disabled: boolean }
For the
controlsConfig
type hint:{ [key: string]: [string | {value: string, disabled: boolean}, ...any[]] }
The text was updated successfully, but these errors were encountered: