Angularjs实现select的下拉列表

时间:2021-01-12 10:11:09

练习使用angularjs实现一个select下拉列表:
Angularjs实现select的下拉列表

 

Angularjs实现select的下拉列表Angularjs实现select的下拉列表
 <div ng-app="selectApp" ng-controller="selectController"> 
<select ng-model="mySelect" ng-options="sd for sd in selectData"></select>
</div>
Html Code

 

Angularjs实现select的下拉列表Angularjs实现select的下拉列表
 var selectApp = angular.module('selectApp', []);

selectApp.controller(
'selectController', function ($scope) {
$scope.selectData
= [
"",
"Insus",
"Insus.NET",
"Leo",
"Leo Yang"];
});
JS Code

 

运行效果动态演示:
Angularjs实现select的下拉列表