We have the following input field and we want the error message to show when the user has inputted 25 characters. However, it is only showing when the user has put in 26 characters.
Here is the input field.
Here is the RegEx:
It seems to be working, like it is highlighting input fields when it is not satisfying provided pattern in
ng-pattern. Also it gives error after
25 because it starts with
24 since it makes an field invalid when its you are entering
As you are just worried about to enter character till 25 length, I'd say Despite of
ng-maxlength attribute by specifying length in it.
<input ng-model="myModel" ng-maxlength="25"/>