关于angularjs $asyncValidators $http的异步验证扩展踩过的那些坑

前端之家收集整理的这篇文章主要介绍了关于angularjs $asyncValidators $http的异步验证扩展踩过的那些坑前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

转载于:点击打开链接


情景:验证用户输入Email是否已注册,扩展$asyncValidators
相关代码如下:
Html code:

?
1
2
3
4
5
6
< div class = "form-group" >
< input type = "email" name = "email" class = "col-md-12 taginput" placeholder = "登录邮箱" asynverification ng-model = "RegIfo.Email" required>
< span ng-show = ' myForm.email.$invalid&&myForm.email.$dirty' >邮箱信息错误。</ span >
< span ng-show = "myForm.email.$pending.asynverification" >正在检测邮箱是否已注册...</ span >
< span ng-show = "myForm.email.$error.asynverification" >邮箱已注册,请更换邮箱!</ span >
</ div >


最终可用扩展代码

详情...

原文链接:https://www.f2er.com/angularjs/149115.html

猜你在找的Angularjs相关文章