angularjs的ng-options时如何设置默认值(初始值)

hhtml:

<select ng-change="change2()" ng-model="selected"
ng-options="item.id for item in datas">
</select>

angualrJs:
$http.get('url').then(function (res) {
$scope.datas= res.data;

$scope.selected= $scope.datas[0];
});
posted @ 2017-08-23 20:47  萧大师  阅读(1337)  评论(0)    收藏  举报