mbenford/ngTagsInput — pull request #186 by alexanderjeurissen (2014-07-08 17:03:08+00:00)
Title: feat(tagsInput): add callback option for invalid-tag event

This pullrequest adds the option for developers to specify a callback
that gets triggered whenever a tag is invalid. This makes it easier
for developers to add custom event handlers for this event.

this especially makes it easier for developers that use https://github.com/mbenford/ngTagsInput/pull/179 to notify the user what tags in their pasted string are invalid.

**a common use case where this feature is required:**
say i have the following tags-input implementation:
```html

```

The regex used in the `allowed-tags-pattern` attribute is a regex that validates if the pasted tag is in the format: `example@domain.com`.

when i paste the following comma separated string: `example@domain.com, invalid@aoeu, example+2@gmail.com` the following happens:

1. the `newTagPasted` method get's called and splits the string on `,`
2. It will call the `tagList.addText` method that depending on the validity of the tag will either call trigger the `onTagAdded` or `invalidTag` event.

Often in a scenario where users paste larger collections / strings we want to know what tags aren't valid. In this example i might want to know that the second email in my string was invalid.