Is it possible to set ng-pattern to something which is return in function? My pattern is create dynamically (depends on what is click on the site), so I need something like this:
<input ng-pattern="myPattern()">
$scope.myPattern = function(){
var list = listFromServer.join('|');
return new RegExp("^(?!.*("+list+")).*$")
}
But it obviously doesn't work. How can I deal with it and create dynamic regex pattern if my 'listFromServer' is also dynamically and depends on user clicking?