$scope.users = [ {name:'a',id:'1'}, {name:'b',id:'2'}, {name:'c',id:'3'} ];"/> $scope.users = [ {name:'a',id:'1'}, {name:'b',id:'2'}, {name:'c',id:'3'} ];">

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

Example introduction of angular select default value

零下一度
零下一度Original
2017-07-27 17:06:591060browse

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,
                    });
                }
            }
        });
<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>


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!

Statement:
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