How to set autoclear on angular ui-mask to false?

Tyler Pflueger picture Tyler Pflueger · Dec 19, 2014 · Viewed 7.6k times · Source

I currently have an input with a ui-mask for a phone. If the value that is inputted isn't the full length of the mask, it clears the input. Is there a way to set the ui-mask so that it doesn't clear the input upon clicking or losing focus?

<input ui-mask="(999) 999-9999" type="text"/>

Answer

John Drouhard picture John Drouhard · Apr 1, 2015

You can set a ui-options attribute that sets the option:

<input ui-mask="(999) 999-9999" ui-options="{clearOnBlur: false}" type="text" />