转载于:点击打开链接
情景:验证用户输入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