码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2017-08-23 21:39:28      阅读:330      评论:0      收藏:0      [点我收藏+]

标签:http   selected   默认值   url   cti   htm   func   cte   pre   

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时如何设置默认值(初始值)

标签:http   selected   默认值   url   cti   htm   func   cte   pre   

原文地址:http://www.cnblogs.com/xyc211/p/7420115.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!