Home > Web Front-end > JS Tutorial > Example introduction of angular select default value

Example introduction of angular select default value

零下一度
Release: 2017-07-27 17:06:59
Original
1061 people have browsed it

I was stumped by a problem with AngularJS again today, and I spent a lot of time solving it

$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,
                    });
                }
            }
        });
Copy after login
<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>
Copy after login


The above is the detailed content of Example introduction of angular select default value. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template