Mask GitHub

What?

Apply a mask on an input field so the user can only type pre-determined pattern.

Model value: {{vm.x}}
Model value: undefined
NgModelController.$viewValue: {{demo.masked.$viewValue}}
NgModelController.$viewValue: undefined
A Any letter.
9 Any number.
* Any letter or number.
? Make any part of the mask optional.
You can use any single char, or exactly space to use space symbol. The default value if nothing is specified is: _

Use the following checkbox to reinitialize the ui-mask by removing and adding the target element from the DOM. Helps with testing different ui-options
input
keyup
click
focus
ui-options{{options | json}}

How?

<input type="text" ng-model="phonenumber" ui-mask="(999) 999-9999"  ui-mask-placeholder ui-mask-placeholder-char="_"/>

Replace "(999) 999-9999" with your desired mask.