天天看点

ng-options指令语法

ng-options一般有以下用法

对于数组:

  • label for value in array
  • select as label for value in array
  • label group by group for value in array
  • select as label group by group for value in array
  • select as label group by group for value in array track by trackexpr

对于对象:

  • label for (key , value) in object
  • select as label for (key ,value) in object
  • label group by group for (key,value) in object
  • select as label group by group for(key, value) in object

说明:

  • array/object:数据源类型,有数组和对象两种
  • value:迭代过程中,引用的数组的项或对象的属性值
  • key:迭代过程中,引用对象的属性名
  • label:选项显示的标签,用户可看到
  • selece:结果绑定到ngModel中,如果没有指定,则默认绑定value
  • group:group by的条件,表示按某条件进行分组
  • trackexper:用于唯一确定数组中迭代项的表达式

参考连接:http://blog.csdn.net/zhujun_xiaoxin/article/details/53184752