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
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/ng/directive/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,33 @@ var inputType = {
* @description
* HTML radio button.
*
* **Note:**<br>
* All inputs controlled by {@link ngModel ngModel} (including those of type `radio`) will use the
* value of their `name` attribute to determine the property under which their
* {@link ngModel.NgModelController NgModelController} will be published on the parent
* {@link form.FormController FormController}. Thus, if you use the same `name` for multiple
* inputs of a form (e.g. a group of radio inputs), only _one_ `NgModelController` will be
* published on the parent `FormController` under that name. The rest of the controllers will
* continue to work as expected, but you won't be able to access them as properties on the parent
* `FormController`.
*
* <div class="alert alert-info">
* <p>
* In plain HTML forms, the `name` attribute is used to identify groups of radio inputs, so
* that the browser can manage their state (checked/unchecked) based on the state of other
* inputs in the same group.
* </p>
* <p>
* In AngularJS forms, this is not necessary. The input's state will be updated based on the
* value of the underlying model data.
* </p>
* </div>
*
* <div class="alert alert-success">
* If you omit the `name` attribute on a radio input, `ngModel` will automatically assign it a
* unique name.
* </div>
*
* @param {string} ngModel Assignable AngularJS expression to data-bind to.
* @param {string} value The value to which the `ngModel` expression should be set when selected.
* Note that `value` only supports `string` values, i.e. the scope model needs to be a string,
Expand Down