如何使用AngularJS来进行表单验证
1个回答
展开全部
<td style="width: 140px;" class="lefttd">
<span class="font-red"> * </span>用户账号:
</td>
<td>
<input id="username" name="username" class="input required" type="text" value="" ng-model="regItem.username" placeholder="用户账号为6-20位大小写字母、数字及下划线" ng-pattern="/^[\w\s]+$/" ng-minlength="6" ng-maxlength="20" required />
<i class="ace-icon fa fa-times-circle"
ng-show="submitted && regForm.username.$invalid"></i>
<i class="ace-icon fa fa-check-circle green" ng-show="regForm.username.$valid"></i>
<i class="error" ng-show="submitted && regForm.username.$invalid">
<small class="error" ng-show="regForm.username.$error.required">用户账号不可为空
</small>
<span class="font-red"> * </span>用户账号:
</td>
<td>
<input id="username" name="username" class="input required" type="text" value="" ng-model="regItem.username" placeholder="用户账号为6-20位大小写字母、数字及下划线" ng-pattern="/^[\w\s]+$/" ng-minlength="6" ng-maxlength="20" required />
<i class="ace-icon fa fa-times-circle"
ng-show="submitted && regForm.username.$invalid"></i>
<i class="ace-icon fa fa-check-circle green" ng-show="regForm.username.$valid"></i>
<i class="error" ng-show="submitted && regForm.username.$invalid">
<small class="error" ng-show="regForm.username.$error.required">用户账号不可为空
</small>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询