When using a pattern that does not allow trailing whitespace (ng-pattern="/^[a-zA-Z0-9]*$/"
for example), entering in the trailing whitespace WILL NOT trigger the ngPattern invalid.
Please see http://plnkr.co/edit/xeWv4bpUiJnYeGlcD0vE?p=preview for test case.
This is against AngularJS 1.3.0 but I suspect the 1.2 branch also has this bug.
You have to add ng-trim="false"
not to trim whitespaces. Please read the documentation
Doh, thanks for the help!
Why oh why did the authors thought ng-trim="true"
is a good default ?
Most helpful comment
You have to add
ng-trim="false"
not to trim whitespaces. Please read the documentation