AngularJS之下拉框(方式三)

1、问题背景

     一般情况下,下拉框分为值和描述,value绑定值,<option></option>中间是描述


2、实现源码

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>AngularJS之下拉框(方式三)</title>
		<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
		<style>
			body,html,div{
				width: 99%;
				height: 99%;
				font-family: "微软雅黑";
				font-size: 16px;
			}
		</style>
		<script>
			var app = angular.module("selectApp",[]);
			app.controller("selectController",function($scope){
				$scope.student = [
					{stuNo:"2016010101",stuName:"张三"},
					{stuNo:"2016010102",stuName:"李斯"},
					{stuNo:"2016010103",stuName:"蝴蝶"},
					{stuNo:"2016010104",stuName:"利是"},
					{stuNo:"2016010105",stuName:"肇庆"},
					{stuNo:"2016010106",stuName:"思胡"}
				];
			});
		</script>
	</head>
	<body ng-app="selectApp" ng-controller="selectController">
		<div style="text-align: center;vertical-align: middle;">
			<select style="width: 200px;">
				<option ng-repeat="stu in student" value="{{stu.stuNo}}">
					{{stu.stuName}}({{stu.stuNo}})
				</option>
			</select>
		</div>
	</body>
</html>

3、实现结果

     

阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/you23hai45/article/details/52348373
文章标签: angularjs JavaScript
个人分类: AngularJS JavaScript
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

AngularJS之下拉框(方式三)

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭