Skip to content

Commit

Permalink
docs(input[radio]): explain what happens with same name on multiple i…
Browse files Browse the repository at this point in the history
…nputs

Closes angular#15009

Closes angular#16478
  • Loading branch information
gkalpak committed Mar 12, 2018
1 parent 64c23e4 commit 6e55b89
Showing 1 changed file with 27 additions and 0 deletions.
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

0 comments on commit 6e55b89

Please sign in to comment.