admin管理员组文章数量:1333383
I am using tagsInput Api in Angular
here is link
i want to add a tag on space. but it is not working.
here is my code
<tags-input ng-model="emails" placeholder="Add an Email" [add-on-space="true"]>
Also i want to add Email validator in tags . i have no idea.
Any idea how to do this ?
Thanks
I am using tagsInput Api in Angular
here is link
i want to add a tag on space. but it is not working.
here is my code
<tags-input ng-model="emails" placeholder="Add an Email" [add-on-space="true"]>
Also i want to add Email validator in tags . i have no idea.
Any idea how to do this ?
Thanks
Share Improve this question edited Jan 7, 2015 at 6:25 Colin Brock 21.6k9 gold badges49 silver badges62 bronze badges asked Jan 7, 2015 at 6:04 Hitu BansalHitu Bansal 3,13712 gold badges55 silver badges89 bronze badges1 Answer
Reset to default 12Try dropping the square brackets from your attribute. e.g.:
<tags-input ng-model="emails" placeholder="Add an Email" add-on-space="true">
Square brackets are just used in their documentation to indicate the ones that are optional. In its current form, your HTML isn't valid.
To validate emails, try the "allowed-tags-pattern" attribute with regex, as below:
<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-.]+$">
Hope this helps.
本文标签: javascriptngTagsInput in AngularStack Overflow
版权声明:本文标题:javascript - ngTagsInput in Angular - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742335029a2455453.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论