I'm trying to have a textarea which contains a list of emails validated with ng-pattern, combined with ng-list.
I've tested my Regex in various testers and it seems to work correctly but not in my application. I'm not sure if the issue is Regex, or interference between ng-pattern and ng-list.
The JSON data I'm recieving for the list is coming in array format:
$scope.mainList.EmailAddresses = ["user@emailaddress.com", "user2@altemail.net"];
My HTML code:
<textarea class="text-list-area" ng-model="mainList.EmailAddresses" ng-pattern="/^((([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6}))\n?)*$/" ng-list=" " ng-trim="false"></textarea>
And the textarea separates each email by a new line like so:
user@emailaddress.com
user2@altemail.net
An example of my issue in a plunker (thanks to Beaver for creating): http://plnkr.co/edit/T17TTd5otnWWXOp2gZ94?p=preview