$scope.selected=0;
<select class="form-control lls-input-lg" id="cooperationPlatform" ng-model="selected">
<option value="0">全部</option>
<option ng-repeat="o in keyArr"
value="{{o.id}}">
{{o.prodName}}
</option>
</select>
出来是这样
而且默认也没有选中
还有一点就是如果我用ng-options 出来是这样子的
value很奇怪,我的数据里面,id:1,这样的,还多了个label
求解答!!
You need to use ng-value for value binding. It is also recommended to add the default options to the array and perform them uniformly
ng-repeat
循环就好了。同时建议命名规范一下哈如:user in users
或produce in produces
in this form.ng-options example
ng-value example
https://docs.angularjs.org/ap...