AngularJS ignoring whitespace in string
10,558
This question is a duplicate of Get trailing white space from input type password to scope?
You're probably looking for ng-trim="false"
. This will update your model including spaces typed into your <input>
.
I updated your fiddle for proof. http://jsfiddle.net/GX5Kr/10/
Author by
makallio85
Updated on June 04, 2022Comments
-
makallio85 almost 2 years
I am having hard time finding out how can I get AngularJS not to ignore whitespaces in strings. Im trying to validate password requirements with AngularJS directive and regex pattern and problem is that I dont want to allow leading or trailing whitespace in password.
Here is fiddle http://jsfiddle.net/GX5Kr/9/
var regex = /^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]{5,})$/;