角JS电子邮件验证与UNI code字 [英] Angular JS Email Validation with unicode characters
问题描述
我有一个注册一个申请表,角JS负责其验证。
I have a sign up form for an application, and angular js is responsible for its validation.
我遇到了一个问题,当角JS不接受有撇号在一个电子邮件地址。 Pear'lpeerh.shin@xyz.com。
I ran into an issue when Angular js wasn't accepting an email address which has apostrophe in it. "Pear'lpeerh.shin@xyz.com" .
我发现angularJs犯规像UNI code字符的电子邮件地址。
I found out that angularJs doesnt like unicode characters in email address.
有任何人穿过一个问题来了这个样子,我想知道我的选择逃脱在angularJs这个bug。
Has anyone else came across an issue like this, I am interested in knowing my options to get away with this bug in angularJs.
任何输入是AP preciated。谢谢!
Any inputs are appreciated. Thanks !
推荐答案
如果有HTML5 <输入类型=电子邮件/>
并不重要,你可以使用<输入类型=文本/>
和模式验证
If having html5 <input type=email />
is not critical, you can use <input type=text />
and pattern validation
<input type="text" ng-model="field" ng-pattern="EMAIL_REGEXP" />
和您可以使用正则表达式的@Andy乔斯林张贴在他的回答
and you can use regex that @Andy Joslin posted in his answer
$scope.EMAIL_REGEXP = /^[a-z0-9!#$%&'*+/=?^_`{|}~.-]+@[a-z0-9-]+(\.[a-z0-9-]+)*$/i;
这篇关于角JS电子邮件验证与UNI code字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!