您好,欢迎访问一九零五行业门户网

详解讲解AngularJS之ng-options 指令

本文主要介绍angularjs ng-options 指令,这里对ng-options指令的知识做了详细整理,并附有详细的代码示例,有需要的小伙伴可以参考下
angularjs ng-options 指令
angularjs 实例
使用数组元素填充下拉列表:
<!doctype html> <html> <head> <meta charset="utf-8"> <script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script> </head> <body> <p ng-app="myapp" ng-controller="myctrl"> <select ng-model="selectedname" ng-options="item for item in names"> </select> </p> <script> var app = angular.module('myapp', []); app.controller('myctrl', function($scope) { $scope.names = ["emil", "tobias", "linus"]; }); </script> <p>该实例演示了如何使用 ng-options 指令填充下拉列表。</p> </body> </html>
定义和用法
ng-options 指令用于使用 a436f88d8f7c0913a3ddc875cb14d4fa 填充 221f08282418e2996498697df914ce4e 元素的选项。
ng-options 指令使用数组来填充下拉列表,多数情况下与 ng-repeat 指令一起使用。
语法
cd722653604ca66806ca00db717d150118bb6ffaf0152bbe49cd8a3620346341
a5e9d42b316b6d06c62de0deffc36939 元素支持该指令。
参数值
值描述
array expression 数组中为 select 元素填充选项的表达式。
以上就是对angularjs ng-options资料的整理,后续继续补充。
以上就是详解讲解angularjs之ng-options 指令的详细内容。
其它类似信息

推荐信息