angular js 表单验证
angular js 表单验证
监听哪一个格式错了
此处是监听长度提示formname.inputname.$error.minlength
<div class="form-group">
<label for="name" class="col-sm-2 control-label">用户名</label>
<div class="col-sm-10">
<input type="text" id="name" class="form-control"
name="name" pattern="[a-zA-Z0-9_]{4,10}" ng-model="name">
</div>
<div class="col-sm-offset-2 text-danger" ng-show="myForm.name.$error.pattern">用户名不满足格式</div>
</div>
表单提交验证
<button type="button" class="btn btn-default" ng-click="subForm()" ng-disabled=Formname.$invalid>提交</button>
确认密码验证
确认密码 name=ensurePsw ng-model="ensurePsw "
密码 name=psw ng-model=psw
<div class="col-sm-10 col-sm-offset-2 text-danger" ng-show=psw!=ensurePsw&&myForm.ensurePsw.$dirty>确认密码和密码不一致</div>