Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

docs(input[radio]): explain what happens with same name on multiple inputs #16478

Closed
wants to merge 2 commits into from

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented Mar 6, 2018

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Docs update.

Does this PR introduce a breaking change?
No

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Fix/Feature: Docs have been added/updated
  • Fix/Feature: Tests have been added; existing tests pass

Other information:
Closes #15009.

@gkalpak
Copy link
Member Author

gkalpak commented Mar 6, 2018

This is what it looks like:
input-radio-docs

@gkalpak gkalpak added this to the 1.6.10 milestone Mar 6, 2018
@Narretz
Copy link
Contributor

Narretz commented Mar 7, 2018

2 things we should note:

  • Since AngularJS uses ngModel to set the radio state, and not the name, the radio state is not constrained to the parent form, but to the scope the ngModel is in.
  • You can still give the radios in a group the same name, but if you need to access each ngModelController individually, you cannot do it

@gkalpak
Copy link
Member Author

gkalpak commented Mar 8, 2018

I do mention that the state of the radion button is determined based on the model data. I am afraid that saying something like "the radio state is not constrained to the parent form, but to the scope the ngModel is in" would sound unnecessarily complicated.

I will expand on what happens when using the same name for multiple radios.

Copy link
Contributor

@Narretz Narretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. It's implicit that when the model changes the checked status, it's not restricted to the parent form.

gkalpak added a commit that referenced this pull request Mar 12, 2018
@gkalpak gkalpak closed this in 6e55b89 Mar 12, 2018
@gkalpak gkalpak deleted the docs-input-radio-names branch March 12, 2018 14:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ng-if around a single radio button removes the entire ngModelController from the formController
4 participants