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

Posted 萧大师

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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];
});









以上是关于angularjs的ng-options时如何设置默认值(初始值)的主要内容,如果未能解决你的问题,请参考以下文章