验证AngularJS中的单选按钮组

时间:2015-01-27 09:14:09

标签: angularjs validation radio-group

在我的代码为<form name="applyform" ng-submit="processForm(applyform.$valid)" class="form-horizontal" novalidate>

的表单中

我有一个单选按钮组,需要选择一个选项。 我无法正常工作。

<div class="form-group noMargin">
                <label for="aanhef" class="col-sm-2 control-label">Aanhef:</label>
                <div class="col-sm-10">
                    <div class="btn-group" data-toggle="buttons">
                        <p ng-show="applyform.aanhef.$invalid" class="help-block">
                            test
                        </p>
                        <label class="btn btn-default">
                            <input type="radio" ng-model="aanhef" name="aanhef" id="Dhr." value="Dhr." ng-required="!aanhef"> Dhr.
                        </label>
                        <label class="btn btn-default">
                            <input type="radio" ng-model="aanhef" name="aanhef" id="Mevr." value="Mevr." ng-required="!aanhef"> Mevr.
                        </label>
                        <label class="btn btn-default">
                            <input type="radio" ng-model="aanhef" name="aanhef" id="Fam." value="Fam." ng-required="!aanhef"> Fam.
                        </label>
                    </div>
                </div>
            </div>

0 个答案:

没有答案
相关问题