当前位置: 移动技术网 > IT编程>脚本编程>AngularJs > angular select 默认值设置方法

angular select 默认值设置方法

2017年12月12日  | 移动技术网IT编程  | 我要评论

如下所示:

<select ng-model="selected" ng-options="x.id as x.name for x in users"></select>
$scope.users = [
    {name:'a',id:'1'},
    {name:'b',id:'2'},
    {name:'c',id:'3'}
  ];
  $scope.selected='2';//id的值,区分类型
  $scope.selected=$scope.users[0].id;//如果想要第一个值

以上这篇angular select 默认值设置方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持移动技术网。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网