Wednesday, December 10, 2014

AngularJS grouping radio buttons on a form

HTML input elements of radio button type are grouped together using the name attribute. With AngularJS forms (and form validation), the name attribute is generally set as a unique identifier. To get grouped radio buttons to work correctly on a form using AngularJS you simply need to set a value to each radio button.

In the example above the two checkboxes are in the same group and share the same angular model. The active value controls which one is set to checked - although this is in textual form and not numeric.

No comments:

Post a Comment