1. 程式人生 > >angularjs的ng-options時如何設置默認值(初始值)

angularjs的ng-options時如何設置默認值(初始值)

-m item 如何 lrj then select model option color

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];
});

angularjs的ng-options時如何設置默認值(初始值)