Created
December 9, 2013 02:34
-
-
Save congjf/7866621 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
AngularJS ngValue |
This file contains hidden or 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
<!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> |
This file contains hidden or 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
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