- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
您好,我正在开发 AngularJS 应用程序,其中我正在对电子邮件 ID 进行验证。每当我输入 test@test 时,都会出现错误消息。但它不起作用。
下面是我的代码。
<div class="inputblock with-icon mail" ng-class="{ 'has-error' : ((form.$submitted && form.email.$invalid)|| (form.email.$invalid && form.email.$dirty))}">
<label class="inputblock-label" ng-show="user.email">{{ 'Email' | translate }}</label>
<span class="input-icon"><img src="images/mail-icon.png"></span>
<div>
<span class="ang-error" style="color:#fff" ng-show="form.email.$dirty && form.email.$invalid">
<span ng-show="form.email.$error.required && form.email.$dirty">* {{'Required' | translate}}</span>
<span style="color:#fff" ng-show="form.email.$error.email">{{'Invalid EmailId' | translate}}</span>
</span>
</div>
<input type="email"
class="with-icon"
ng-pattern="/^[_a-z0-9]+(\.[_a-z0-9]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/"
placeholder="{{ 'Email' | translate }}"
ng-model="user.email"
required=""
name="email"
my-maxlength="50">
</div>
每当我输入 test@test 时,我都可以在浏览器中看到以下代码
<input type="email" class="with-icon ng-dirty ng-valid-required ng-invalid ng-invalid-pattern ng-valid-email ng-touched" ng-pattern="/^[_a-z0-9]+(\.[_a-z0-9]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/" placeholder="Email" ng-model="user.email" required="" name="email" my-maxlength="50" ng-trim="True">
我可以知道如何修复上述错误吗?任何帮助,将不胜感激。谢谢
最佳答案
你可以试试这个:
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,3}$/;
$scope.model = "test@test";
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
<form name="form">
<input type="text" ng-model="model" id="input" name="input" ng-pattern="emailPattern" /><br>
<p>input valid? = {{form.input.$valid}}</p>
</form>
</div>
关于javascript - Angular js 电子邮件验证不适用于域名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46363984/
以下帖子可能看起来相同,但在尝试作为答案提供的所有解决方案后,我无法纠正问题。(Login failed for user 'DOMAIN\MACHINENAME$') 我的问题 我正在 Window
域名、虚拟主机是什么意思?有的新手用户不理解,为什么做网站要买域名和空间才行。这里我们来分别介绍下域名和虚拟主机。 关于域名 域名通俗的说,就是你网站的名号,你注册域名之后就以这个名号去宣传
我有一台具有2个域名的服务器(比如domain1.com和domain2.com)。 我可以通过ssh user@domain1.com和ssh user@domain2.com SSH进入服务器。我
我已经设置了一个 Ubuntu LAMP 服务器,并且我的网站可以正常运行 phpmyadmin。但是,我最近不得不为我的 IP 地址创建一个虚拟主机,以避免 Tomcat 中的目录列表出现安全问题,
Nginx可以为某一个域名单独加用户认证,具体做法如下: 1. 生成用户认证的用户名和密码: 复制代码代码如下: #wget -c soft.vpser.net/ln
Centos中基于IP的虚拟主机搭建 首先,检查是否已安装httpd软件包 安装httpd软件包 安装完成 启动服务 主配置文件是/etc/httpd/conf/htt
1、什么是泛域名解析? 泛域名解析是指将*.域名解析到同一IP。 在域名前添加任何子域名,均可访问到所指向的WEB地址。也就是客户的域名a.com之下所设的*.a.com全部解析到同一个IP地
我知道 WordNet 有域层次结构:例如运动->足球。 1) 是否可以列出所有与“sport->football”子域相关的单词? Response: goalkeeper, forward,
我正在尝试为我正在处理的项目的 URL 缩短器设置一个带有 .ka 后缀的域。例如类似于 drbl.in。我在网上查了一下,这个后缀似乎还没有在任何国家注册过,也没有出现过任何域名服务。关于如何解决这
我在设置 Openfire 时遇到问题。 Openfire 设置中的默认 XMPP 域名显示我的计算机名称,因此每当我通过 Spark 进行测试时,它都不起作用。 我尝试了我拥有的域,但在 openf
我正在使用 Joomla 的 JSN Uniform 插件来接收电子邮件,但它不接受 .company 域作为有效域。它接受常用域(com、net、org、info、biz 等),但不接受 .comp
我创建了一个域名并将其重新定义为您的外部 IP 地址。同时启动 nginx 和 tomcat。将域重新定义为外部 IP 地址。 truckpart4you.com:8081/spring 我想隐藏80
与子域相反。 我试过了。 var a = window.location.hostname.match(/(www.)?([^\.]*)\./)[2]; 但这会抢 frozen-dusk-2587
我正在使用 django 的 send_mail 发送一封电子邮件(使用模板),其中包含以下行: 要重置密码,请点击以下链接: http://localhost:8000/{% url 'reset_
来自 Scrapy 教程: domain_name: identifies the Spider. It must be unique, that is, you can’t set the same
一个快速简单的正则表达式问题 我在字符串中有一个域名,我需要删除它 - 总是有 http://www. 并且域总是以“/”结尾 g_adv_fullpath_old = g_adv_fullpath_
我需要 xslt 版本 2 在记录或元素级别为“xml”属性前缀 (xml:lang="en-us") 生成域名: xmlns:xml="http://www.w3.org/XML/1998/name
如何获取机器的域名(如果机器实际上已加入域)? 当然,如果机器没有加入域,函数应该返回 null,或 空字符串,或 机器的名称,或 "." 注意事项: NetGetJoinInformation Wi
这个手机号码正则验证函数可以说是最新的都支持的,里面有详细的介绍说明,不论以后增加什么号段大家都非常容易的稍微修改一下即可。 javascript 手机号码正则表达式验证函数 复制代码 代码如下:
我使用 Google 域在 Github Pages 上托管我的网站,在 Chrome 中的 iPhone 上运行完美 但是在我的桌面上,Chrome(我的普通浏览器(我确实检查了缓存))或 Fire
我是一名优秀的程序员,十分优秀!