Answer the question
In order to leave comments, you need to log in
Angular ng-pattern. How to check the data?
Help solve the problem, please.
To begin with, I want to set a condition: all English letters.
From what I read in the documentation https://docs.angularjs.org/api/ng/directive/ngPattern
I don't quite understand why the pattern looks like this? $scope.regex = '\\d+';
and not like in pure JS? $scope.regex = '/\d+/';
My code
<form method="post" name="signupForm" ng-submit="register()" role="form">
<input ng-pattern="username" type="text" name="displayName" ng-model="user.fullName" placeholder="Full Name" required>
</form>
$scope.username = "/^[a-zA-Z]*$/";
Answer the question
In order to leave comments, you need to log in
The code is incomplete, so offhand:$scope.username = /^[a-zA-Z]{5,25}$/;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question