先上一段代码:
<select ng-model='SomeModel' ng-options="item.name as item.name for item in getItemList()" class='form-control'></select>
首先,将ng-options表达式分成两部分:
第一部分是A as B,A是将要赋值于SomeModel的(藏在背后的),B是将会显示在select选择器上的;
第二部分是for C in D,这就是一个for..in循环。
ng-options="item.name as item.name disable when item.name=='--Select Item--' for item in getItemList()"
disable when是固定语法,用于指定某条件下不可选