Skip to content

Instantly share code, notes, and snippets.

@yszou
Last active Aug 29, 2015
Embed
What would you like to do?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>angularjs</title>
<script src="http://cdn.staticfile.org/jquery/2.1.0/jquery.min.js" type="text/javascript"></script>
<script src="http://cdn.staticfile.org/angular.js/1.0.8/angular.min.js" type="text/javascript"></script>
</head>
<body>
<form name="test_form" ng-controller="TestCtrl" ng-init="o=[0,1,2,3]; a=o[1];">
<select ng-model="a" ng-options="x for x in o" ng-change="show()">
<option value="">可以加这个空值</option>
</select>
</form>
<script type="text/javascript">
var TestCtrl = function($scope){
$scope.show = function(){
console.log($scope.a);
}
}
angular.bootstrap(document.documentElement);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment