angular select 默认值的实例介绍
程序员文章站
2022-05-06 13:33:13
...
今天又被一个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>
以上就是angular select 默认值的实例介绍的详细内容,更多请关注其它相关文章!