Reputation: 3137
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
Upvotes: 0
Views: 1816
Reputation: 124
Try 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.
Upvotes: 12