$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'} ];">
今天又被一個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 預設值的實例介紹的詳細內容。更多資訊請關注PHP中文網其他相關文章!