Rumah >hujung hadapan web >tutorial js >angular select 默认值的实例介绍
今天又被一个AngularJS的一个问题给难住了,有花了比较多的时间去解决
$scope.addalerts = []; /* 查询 */ $scope.proID = $stateParams.id; if($scope.proID){ GoodsModelService.goodsInfo({ id:$scope.proID },function(result){ if(result.code == 1000){ $scope.proDetail = result.data.goods_info; //总分类 $scope.goodsType = result.data.goods_type; //得到分类的id,传到总分类,得到当前返回值 $scope.goodsTypes = result.data.goods_info.type; if( result.data.goods_info.goods_module){ $scope.addalerts = result.data.goods_info.goods_module; }else{ $scope.addalerts.push({ module_title:null, module_desc:null, }); } } });
<div class="col-sm-8"> <select class="form-control" ng-model="goodsTypes" ng-options="g.id as g.name for g in goodsType"> <!--<option value="">- 请选择 -</option>--> </select> </div>
Atas ialah kandungan terperinci angular select 默认值的实例介绍. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!