KingKongFrog KingKongFrog - 1 year ago 175
AngularJS Question

angular restriction to not allow spaces in text field

I do not want a user to enter spaces in a text field. I don't want it on submit validation but rather - a space will not show up on the text field when they click it.

Answer Source
<input ng-model="field" ng-trim="false" ng-change="field = field.split(' ').join('')" type="text">