Home > Web Front-end > JS Tutorial > body text

AngularJS drop-down box (method 3)

黄舟
Release: 2017-02-18 13:54:12
Original
1101 people have browsed it

1. Problem background

Generally speaking, the drop-down box is divided into value and description, value is bound to the value, in the middle Description


2. Implementation source code

<!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,p{
				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">
		<p 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>
		</p>
	</body>
</html>
Copy after login


3. Implementation result

AngularJS drop-down box (method 3)

The above is the content of the AngularJS drop-down box (method three). For more related information, please Follow the PHP Chinese website (www.php.cn)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!