Ng-list with regex

I found an old jsfiddle where someone uses a regex pattern for the delimiter from ng-list http://jsfiddle.net/MrSteve/tnY6m/1/ .

I tried this in Angular 1.3.x and can't get it to work.

Is there a way to accept multiple delimiters with ng-list, so I can split by ,or ;?

+4
source share
2 answers

This fiddle seems to be your solution:
http://jsfiddle.net/MrSteve/tnY6m/1/

You should change your regex to: /[,;]/

0
source

- , , angular . , , $watch , .

, . .

<textarea ng-model="names" rows="4"  width="100%"></textarea>

$scope.$watch('names', function() {
        var re = /[,\s]/g;
        $scope.emails = $scope.names.split(re)
    });
0

All Articles