ng-options指令

  在angularJS中创建select下拉是使用ng-options创建下拉项

ng-options="val as label for element in array"  //设置option的value值为val

ng-options="lable for element in array"  //不设置option的value值,默认为element对象

ng-options="(label)group by group for element in array"  //不设置option的value值,默认为element对象

<div ng-controller="selectCtrl">
<select ng-model="menu" ng-options="m.id as m.name for m in selectArray"></select>
{{menu}}
</div>
myApp.controller('selectCtrl',function($scope){
$scope.selectArray=[
{id:'1', name:'apple'},
{id:'2', name:'pear'}
]
})

angularJS select的更多相关文章

  1. AngularJS select中ngOptions用法详解

    AngularJS select中ngOptions用法详解   一.用法 ngOption针对不同类型的数据源有不同的用法,主要体现在数组和对象上. 数组: label for value in a ...

  2. AngularJS学习之旅—AngularJS Select(十)

    1.AngularJS Select(选择框) AngularJS 可以使用数组或对象创建一个下拉列表选项. ng-option:创建一个下拉列表,列表项通过对象和数组循环输出 eg: <div ...

  3. AngularJS Select(选择框)

    AngularJS 可以使用数组或对象创建一个下拉列表选项. 使用 ng-option 创建选择框 在 AngularJS 中我们可以使用 ng-option 指令来创建一个下拉列表,列表项通过对象和 ...

  4. Angularjs select的使用

    实例一:基本下拉效果 usage: label for value in array <!-- lang: html --> <select ng-model="selec ...

  5. angularjs select标签中参数的传递

    今天做的一个demo中需要一个下拉选择框,并根据所选择的内容向服务器发送请求. 首先百度了一下angularjs关于select的使用,一种采用ng-repeat的方式. <select ng- ...

  6. angularjs select下拉搜索框

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. 转: angularjs select 赋值 ng-options配置方式

    摘自: http://blog.csdn.net/chwshuang/article/details/53861249 数组方式 数据是数组 $scope.years = [2014, 2015, 2 ...

  8. angularjs select 循环中出现第一个 option 为空格问题

    当select 的ng-module 为空时, select显示空白行. 解决:指定ng-module的默认值.

  9. angularjs select一些坑

    用select下拉框时,很容易出现第一个默认选择框是空白的情况. 就像这样: 平常我们可以在options中设置selected属性达到默认选择的目的. 同样的,我们可以在控制器中写入select的初 ...

随机推荐

  1. [LeetCode] Implement Queue using Stacks 用栈来实现队列

    Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of ...

  2. [LeetCode] Largest Rectangle in Histogram 直方图中最大的矩形

    Given n non-negative integers representing the histogram's bar height where the width of each bar is ...

  3. AppBoxPro - 细粒度通用权限管理框架(可控制表格行内按钮)源码提供下载

    特别声明: 提供的源代码已经包含了 AppBoxPro 的全部源代码,用 VS2012 打开项目后,直接 Ctrl+F5 可以运行起来(默认使用VS自带的LocalDB数据库). FineUIPro是 ...

  4. 【svn】在提交文件是报错:previous operation has not finished;run 'cleanup' if it was interrupted

    1.svn在提交文件是报错:previous operation has not finished;run 'cleanup' if it was interrupted2.原因,工作队列被占用,只需 ...

  5. Error 1606 Could Not Access Network Location %SystemDrive%/inetpub/wwwroot/ 的错误解决方法

    在卸载或者重安装Infragistics NetAdvantage时候提示如标题的错误 win7下 1.打开注册表 Regedit 2.找到HKEY_LOCAL_MACHINE/SOFTWARE/Mi ...

  6. windows和linux执行class

    windows java -classpath .;lib/* com.Test linux java -classpath .:ib/* com.Test "."代表当前路径,这 ...

  7. 让PDF.NET支持不同版本的SQL Server Compact数据库

    最近项目中需要用到嵌入式数据库,我们选用的数据开发框架是PDF.NET(http://www.pwmis.com/SqlMap/),之前的博文已经总结了让PDF.NET支持最新的SQLite,今天我们 ...

  8. IRandomAccessStream, IBuffer, Stream, byte[] 之间相互转换

    /* * 用于实现 IRandomAccessStream, IBuffer, Stream, byte[] 之间相互转换的帮助类 */ using System;using System.IO;us ...

  9. 动手实践记录(利用django创建一个博客系统)

    1.添加一个分类的标签,和主表的关系是 外键 class Category(models.Model): """ 分类 """ name = ...

  10. 发送ajax请求时页面被刷新

    浏览器默认会认为 button 的属性是submit.type='submit',会发生提交表单的默认行为,为button添加type="button"即可.