关于angular select默认值问题

 $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>

  

posted @ 2017-01-23 11:51  幸福的目标  阅读(2559)  评论(0编辑  收藏  举报