ng-select
来源:互联网 发布:新日铁住金软件 地址 编辑:程序博客网 时间:2024/05/05 02:46
ng-select用来将数据同HTML的<select>元素进行绑定。这个指令可以和ng-model以及ng-options指令一同使用,构建精细且表现优良的动态表单。
ng-options的值可以是一个内涵表达式(comprehension expression),其实这只是一种有趣的说法,简单来说就是它可以接受一个数组或对象,并对它们进行循环,将内部的内容提供给select标签内部的选项。它可以是下面两种形式。
数组作为数据源:
用数组中的值做标签;
用数组中的值作为选中的标签;
用数组中的值做标签组;
用数组中的值作为选中的标签组。
对象作为数据源:
用对象的键值(key-value)做标签;
用对象的键值作为选中的标签;
用对象的键值作为标签组;
用对象的键值作为选中的标签组。12
下面看一个ng-select指令的实例:
<div ng-controller="CityController"> <select ng-model="city" ng-options="city.name for city in cities">
<option value="">Choose City</option>14</select>
Best City: {{ city.name }}</div>
angular.module('myApp',[]).controller('CityController',function($scope) {
$scope.cities = [ {name: 'Seattle'}, {name: 'San Francisco'}, {name: 'Chicago'}, {name: 'New York'}, {name: 'Boston'}
];});
15161718
2 0
- ng-select
- [Angularjs]ng-select和ng-options
- angularjs select ng-model ng-options
- [Angularjs]ng-select和ng-options
- angularjs: ng-select和ng-options
- angular select ng-options和ng-repeat
- AngularJS中 ng-select 实例
- angularjs select标签 ng-options ng-change学习
- ng-select 与 ng-options 的简单使用
- Angularjs中ng-select和ng-options的用法详解
- angular select中ng-options使用
- select option ng-repeat多空白项
- angularjs select 赋值 ng-options配置方式
- angularjs select 赋值 ng-options配置方式
- Angularjs中ng-select和ng-options用法【select联动数据】
- Angularjs中select 的ng-repeat 和 ng-options 用法和获取选取值
- Angularjs中select 的ng-repeat 和 ng-options 用法和获取选取值
- AngularJS v1.6.3,在select标签中使用ng-options无法触发ng-change事件
- 【C语言】链表 题
- 使用valgrind检查内存使用问题
- ng-click
- ZOJ 3929 Deque and Balls
- 【剑指offer系列】 数组中逆序对___36
- ng-select
- 《c++ primer》第六章 函数
- android 布局属性(alignBaseLine在最后有详细解释)
- C#基础之配置文件(FAQ)
- Python学习笔记-偏函数
- ng-submit
- 无锁编程:lock-free原理
- CSS3之选择器1(属性选择器,结构伪类)
- ng-class