Created
July 7, 2012 06:23
-
-
Save mpdaugherty/3065072 to your computer and use it in GitHub Desktop.
Example of how to correctly use radio inputs with Angular JS's ng:Repeat directive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div ng-repeat="m in milestone_choices" class="row-fluid"> | |
<label><input type="radio" name="meaningless" value="(( $index ))" ng-model="milestone_data.index" /> | |
<span ng-bind="m.title"></span></label> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.milestone_data = { index: 0 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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"/> | |
<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
Top