JS代碼ui
integration.controller("ContractFlow.Approval.Controller", [ "$scope", "$state", function ($scope, $state) { $scope.Model = []; $scope.Model.IsSample = 0; } ]);
HTML代碼spa
<div class="form-group"> <label class="control-label col-xs-1">合同範本:</label> <div class="col-xs-4"> <div class="radio"> <label> <input type="radio" name="IsSample" required ng-model="Model.IsSample" value="1"> <span>使用範本</span> </label> <label> <input type="radio" name="IsSample" required ng-model="Model.IsSample" value="0"> <span>無範本</span> </label> </div> </div> </div>
效果:默認選中無範本數據code
使用ng-model綁定數據,若源數據與value值相等,則選中該選項orm