$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>
It comes out like this
And it is not selected by default
Another point is that if I use ng-options, it will look like this
The value is very strange. In my data, id: 1, like this, there is an additional label
Please answer! !
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...