Angular 中的 ngTagsInput
ngTagsInput in Angular
我在 Angular
中使用 tagsInput Api
这里是link
我想在 space 上添加标签。但它不起作用。
这是我的代码
<tags-input ng-model="emails" placeholder="Add an Email" [add-on-space="true"]>
我还想在标签中添加电子邮件 validator。我不知道。
知道怎么做吗?
谢谢
尝试去掉属性中的方括号。例如:
<tags-input ng-model="emails" placeholder="Add an Email" add-on-space="true">
方括号只是在他们的文档中用来表示可选的。在当前形式下,您的 HTML 无效。
要验证电子邮件,请使用正则表达式尝试 "allowed-tags-pattern" 属性,如下所示:
<tags-input ng-model="emails" placeholder="Add an Email" add-on-space="true" allowed-tags-pattern="^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$">
希望对您有所帮助。
我在 Angular
中使用 tagsInput Api这里是link
我想在 space 上添加标签。但它不起作用。
这是我的代码
<tags-input ng-model="emails" placeholder="Add an Email" [add-on-space="true"]>
我还想在标签中添加电子邮件 validator。我不知道。
知道怎么做吗?
谢谢
尝试去掉属性中的方括号。例如:
<tags-input ng-model="emails" placeholder="Add an Email" add-on-space="true">
方括号只是在他们的文档中用来表示可选的。在当前形式下,您的 HTML 无效。
要验证电子邮件,请使用正则表达式尝试 "allowed-tags-pattern" 属性,如下所示:
<tags-input ng-model="emails" placeholder="Add an Email" add-on-space="true" allowed-tags-pattern="^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$">
希望对您有所帮助。