Skip to content

Instantly share code, notes, and snippets.

@congjf
Created December 9, 2013 02:34
Show Gist options
  • Save congjf/7866621 to your computer and use it in GitHub Desktop.
Save congjf/7866621 to your computer and use it in GitHub Desktop.
<!doctype html>
<html ng-app>
<head>
<script src="http://code.angularjs.org/1.2.4/angular.min.js"></script>
<script src="script.js"></script>
</head>
<body>
<form ng-controller="Ctrl">
<h4 id="example_which-is-your-favorite">Which is your favorite?</h4>
<label ng-repeat="name in names" for="{{name}}">
{{name}}
<input type="radio"
ng-model="my.favorite"
ng-value="name"
id="{{name}}"
name="favorite">
</label>
</span>
<div>You chose {{my.favorite}}</div>
</form>
</body>
</html>
function Ctrl($scope) {
$scope.names = ['pizza', 'unicorns', 'robots'];
$scope.my = { favorite: 'unicorns' };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment