Skip to content

Instantly share code, notes, and snippets.

@klebergraciasoares
Forked from mpdaugherty/right_radios.html
Created April 1, 2016 11:23
Show Gist options
  • Save klebergraciasoares/4c5bee0db1c34f3ffc13f80131939416 to your computer and use it in GitHub Desktop.
Save klebergraciasoares/4c5bee0db1c34f3ffc13f80131939416 to your computer and use it in GitHub Desktop.
Example of how to correctly use radio inputs with Angular JS's ng:Repeat directive
<div ng-repeat="m in milestone_choices" class="row-fluid">
<label><input type="radio" name="meaningless" value="(( $index ))" ng-model="milestone_data.index" />
&nbsp;<span ng-bind="m.title"></span></label>
</div>
$scope.milestone_data = { index: 0 };
<input name="milestone" type="hidden" value="(( repo.name + '--milestone--' + milestone.number ))"/>
<select ng-show="milestone_choices.length"
ng-model="milestone" ng-options="m.title for m in milestone_choices">
</select>
<div ng-repeat="milestone in milestone_choices" class="row-fluid">
<input type="radio" ng-model="milestone" name="milestone" value="(( repo.name + '--milestone--' + milestone.number ))" ng-model="milestone"/>
&nbsp;<span ng-bind="milestone.title"></span>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment