1.最初,循环数组,只知道用ng-repeat;后来才知道select不用ng-repeat也能实现循环输出(ng-options,一定不要忘了末尾的s):
最初:
<select id="column" name="columnname" class="form-control" required="required" ng-model="content.id">
<option ng-repeat="item in columns" value="{{item.uuid}}">{{item.name}}</option></select>
改善:
<select class="form-control" ng-model="content.id" ng-options="item.uuid as item.name for item in columns" required></select>
解析:
columns是一个json数组;
C.a as C.b for C in array:意思是显示C的b属性,但数据绑定的是C的a属性,即当选择一项时,content.id = a;
2.选择一个列表项后触发事件:ng-change,写在select里。