ng-pattern allowing spaces following pattern , cannot understand why so.
ng-pattern="/^[a-za-z\d\-\_]+$/" i have tried without escaping - , _, , result same: classes ng-valid , ng-valid-pattern applied.
i trying allow a-z (both capital , lower case) , dash , underscore. pattern seems work i'd expect on regex101 quite confusing.
update: text field marked invalid after valid character typed after space, not when space first character: eg (not hardcoded this, "sometext" , "some text" typed text inputs):
<input> sometext</input> //ng-valid <input>some text</input> //ng-invalid still quite confused why be.
angular trims inputs automatically. can disable ng-trim="false"
<input type="text" ng-model="model" ng-trim="false" ng-pattern="/^[a-za-z\d\-\_]+$/"/>
Comments
Post a Comment