question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve documentation for boxed values in form control

See original GitHub issue

I’m submitting a …

[ ] Regression (behavior that used to work and stopped working in a new release)
[ ] Bug report 
[ ] Feature request
[x] Documentation issue or request
[ ] Support request

Current behavior …

https://github.com/angular/angular/blob/acf6075ca9aa92121bb0166b2b7560aeb2c167ff/packages/forms/src/form_builder.ts#L57 and https://github.com/angular/angular/blob/acf6075ca9aa92121bb0166b2b7560aeb2c167ff/packages/forms/src/form_builder.ts#L105

The documentation about the parameter formState in the method control(..) and the parameter controlsConfig in the method group(..) (see line reference) doesn’t explain very well how to set it. Additionally, the type hints has presence of anys 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[]] }

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
AndrewKushnircommented, Jun 8, 2020

Hi @jpchavat, thanks for creating this ticket.

It looks like there are 2 parts that we need to look into:

  • improvements to the Forms package typings. This is one of the pain points for Forms users and we plan to perform improvements in this area, see https://github.com/angular/angular/issues/13721#issuecomment-637698836.
  • additional docs on possible values for the formState argument to better describe that an object with value and disabled keys can be used. We can look into this part once the types are updated (so we can refer to updated types in additional docs).

Thank you.

1reaction
kapunahelewongcommented, Jun 8, 2020

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overview of forms, Form controls, and ActiveX controls on a ...
Create, edit, format, lock, and unlock Excel forms, including data forms, worksheets that contain Form and ActiveX controls, and VBA UserForms.
Read more >
Form controls · Bootstrap v5.2
Form controls. Give textual form controls like <input> s and <textarea> s an upgrade with custom styles, sizing, focus states, and more. On...
Read more >
FormControl - Angular
Tracks the value and validation status of an individual form control. See more... class FormControl<TValue ...
Read more >
Forms in HTML documents - W3C
17.1 Introduction to forms. An HTML form is a section of a document containing normal content, markup, special elements called controls (checkboxes, ...
Read more >
<input>: The Input (Form Input) element - HTML
The <input> HTML element is used to create interactive controls for web-based forms in order to accept data from the user; a wide...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found