如何使用angularjs在ng-dialog中验证输入标签?

时间:2015-10-13 05:40:23

标签: angularjs validation ng-dialog

这是我的代码



$scope.student={};

<script type="text/ng-template" id="saveApprovalPhaseId">
    <div class="ngdialog-message">
        <h4>Student Creteria</h4>
        <div class="col-xs-12 col-sm-12 col-lg-12 paddnone">
            <div class="form-group">
                <div class="col-xs-12 col-sm-12 col-lg-12 paddnone">
                    <div class="radio-inline col-md-12 my-radio">
                        <div class="col-md-1"><input type="radio" ng-model="student.criteria" name="inlineRadioOptions" id="inlineRadio1" value="percentage"></div>
                        <div class="col-md-4">Precentage</div>
                        <div class="col-md-7"><input class="form-control" type="text" id="exampleInputEmail2" placeholder="" required></div>
                    </div>
                    <div class="clearfix"></div><div class="radio-inline col-md-12 my-radio">
                        <div class="col-md-1"><input type="radio" ng-model="student.criteria" name="inlineRadioOptions" id="inlineRadio1" value="all"></div>
                        <div class="col-md-4">All</div>
                        <div class="col-md-7"></div>
                    </div>
                    <div class="clearfix"></div><div class="radio-inline col-md-12 my-radio">
                        <div class="col-md-1"><input type="radio" ng-model="student.criteria" name="inlineRadioOptions" id="inlineRadio1" value="requiredAll"></div>
                        <div class="col-md-4">Required All</div>
                        <div class="col-md-7">
                            <select class="form-control" >
                                <option ng-repeat="i in getNumber(isMandatoryCount) track by $index">{{$index+1}}</option>
                            </select>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                    <div class="radio-inline col-md-12 my-radio">
                         <div class="col-md-1"></div>
                         <div class="col-md-4"></div>
                         <div class="col-md-7">
                               <button class="btn btn-primary mart15" ng-click="create()">Ok</button>
                         </div>
                    </div>
                </div>
            </div>
            <div>
            </div>
        </div>
    </div>
</script>
&#13;
&#13;
&#13;

在上面的脚本中使用ng-dialog用于打开弹出窗口。此弹出窗口包含3个单选按钮。当用户选择第一个radiobutton启用文本字段输入百分比时,接下来选择第二个radiobutton禁用文本框并选择标签,然后选择所需的禁用文本框并启用选择标签。最后当用户点击按钮根据条件验证整个弹出窗口时。

0 个答案:

没有答案