javascript - Dynamicaly changing ng-pattern regex -
i want changing regex pattern same rules. example in plunker
if selected type, have regular expression, model updated, if value valid. if selected type, doesn't have regular expression (e.g. 'string' in code), model never updated. doesn't matter, if function returned null or empty string.
my question is, if exist way, how turn validation off?
you can return .*
when want allow input:
$scope.getvalidatorregex = function () { switch ($scope.type) { case 'int': return /^\d+$/; default: return /.*/; } };
Comments
Post a Comment