Angular--Radio

1.radio單選按鈕綁定數據

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

相關文章
相關標籤/搜索
本站公眾號
   歡迎關注本站公眾號,獲取更多信息