- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 ngTagsInput Angular 插件来获取多个电子邮件 ID。下面是我的代码:
<form name="contact_us" role="form" novalidate enctype="multipart/form-data">
<div class="form-group">
<label class="control-label" for="from_email">
From
</label>
<tags-input ng-model="contactUs.emails" type="email" id="from_email"
placeholder="From" name="from_email"
allowed-tags-pattern="^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+.)+[A-Za-z]{2,}"
allow-leftover-text="false" ng-required="true" add-on-space="true">
</tags-input>
<p class="help-block" style="color:red"
ng-show="contact_us.from_email.$invalid && (contact_us.$submitted || contact_us.$dirty)">
Please enter proper email address
</p>
<button type="submit" class="btn btn-default" ng-click="Send(contact_us)">
Send
</button>
</form>
在上面的代码3中添加了验证,如下:
以上案例运行良好。但是,我想根据上面发生的一种情况动态显示错误消息。请帮帮我!
最佳答案
ngTagsInput 支持以下属性来捕获更改,它在添加到模型之前触发
on-tag-adding="foo($tag)"
$scope.foo(function(tag){
// look for error
// if found return false
// change the text of tag
tag.text='what ever';
return tag;
})
关于javascript - 在 ngTagsInput 中如何显示不同情况的验证消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32422861/
如果你从一个来源拉 [{文本:'a'},{文本:'ab'},{文本:'abc'}] 并且用户输入“abcd”,您如何防止用户创建“abcd”标签? 最佳答案 只需将 addFromAutocomple
我正在使用 ngTagsInput我的应用程序中的库。设置必需的关键字不会影响表单验证。为什么会这样? 最佳答案 required 指令可能只适用于常规文本输入。相反,您可以使用 ngTagsInp
我正在尝试创建一个带有自动完成功能的标签输入字段。这是 Angular 代码: var app = angular.module('plunker', ['ngTagsInput']);
我将这样的 2.1.1 版本的 ngtagsinput 注入(inject)到我的 Controller 中: app.controller('homeCtrl', ['$scope','$http'
我想在我的项目中使用 ng-tags-input。 我尝试根据数组中的颜色属性对象为每个标签设置不同的颜色。 这里是 plunker我正在努力。 为此,我需要覆盖 ng-input 模板中的标签项 c
我在 Angular 中使用 tagsInput Api 这里是link 我想在空间上添加一个标签。但它不起作用。 这是我的代码 我还想在标签中添加电子邮件验证器。我不知道。 知道如何做到这一点吗?
我正在使用 ngTagsInput Angular 插件来获取多个电子邮件 ID。下面是我的代码: From Plea
我正在使用 ngTagsInput渲染一些自动完成标签的插件。我在我以前的一个元素中使用过它并且工作得很好。 但是,在我的新元素中,当我添加 ngTagsInput CSS 时,它不会显示供用户键入标
我试图找出这个问题,但我没有运气。 这是我写的有效的plunker。请注意,当我使用 $http.get 访问 tags.json 时,代码运行良好。 Angular 指令代码: app.direct
我刚开始使用 ngTagsInput Angular 库,但在更新模型时遇到了问题。我在 ionicPopup 中显示标签输入,有趣的是,标签上添加的事件触发,显示 $scope.sites[] 已填
我正在尝试使用 tagsInputConfig 提供程序为 onTagAdding 回调设置默认函数。没有成功。 tagsInputConfig.setDefaults('tagsInput', {
例如我想在 addedValue 这是我使用的代码。 最佳答案 您可以使用 on-tag-adding 属性来检查它是否是一个有效的标签: 在你的 Controller 中: $scope.che
我有使用 AngularJS 和 NGTagsInput 的代码。我在自动完成中使用过滤器,您可以按“Enter”添加新的项目,但我想向用户显示此消息。如果自动完成中没有结果,则显示消息:“未找到结果
这是我的index.html
我正在使用ngTagsInput用于标记功能。 ngTagsInput 按预期工作正常。但是在加载我的应用程序时。我在浏览器控制台中看到两条错误消息。 我已附上错误消息快照。我尝试过使用 ngTags
我是 AngularJS 的新手,目前正在开发一个输入字段,该字段可以一次接受多个标签以及自动完成功能,该功能将可用标签显示为下拉选项。为此,我使用 ngTagsInput我在网上找到的指令( htt
我正在使用 https://github.com/mbenford/ngTagsInput . 我创建了一个基本表单,其中包含一个 url 和一个必需的标签输入字段。由于需要,我使用了属性 min-t
我是初学者,我正在尝试保存支持 use-strings 的 ng-tags-input 版本 3.2.0。我正在尝试通过 PHP 保存标签中的项目。 我经历了内爆,但它没有显示或保存任何东西。如果没有
在尝试使用 ngTagsInput 时如何防止出现此消息?我尝试进入模块并输入: var app = angular.module("SinglePageApplication", [ "ngRout
我试图在 ngTagsInput 中使用自动完成功能,但出现以下错误: Error: [ngRepeat:dupes] http://errors.angularjs.org/1.2.9/ngRepe
我是一名优秀的程序员,十分优秀!