Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the use of angular ui-mask?

https://htmlpreview.github.io/?https://github.com/angular-ui/ui-mask/master/demo/index.html

This is the only documentation that i could find. And it does not make much sense to me. There is no official demo available as far as i can see.

ui-mask-placeholder and ui-mask-placeholder-char do not seem to work.

When the user types some value in the masked field, the mask vanishes and the user can type any value he wants. So basically I am just left using a placeholder. Then what is the point of the ui-mask? What am I missing?

like image 732
Aditi Avatar asked Dec 18 '22 15:12

Aditi


1 Answers

ui-mask defines a input pattern and forces the user to put a value that fit with it.

For instance, with a mask set to (999) 999-9999, the user will ony be able to put some values as (123) 456-7890.

The mask definition considers these patterns:

A Any letter.

9 Any number.

* Any letter or number.

? Make any part of the mask optional.

So, if you define a mask as AAAAA-AAAAA, user can only write some hello-world or qwert-yuiop as value (Only letters).

The default placeholder char is the char that is used as "fill" in the input when it's focused and the value is empty:

If you choose a mask AAAAA-AAAAA and a default placeholder char _ (default), you will have _____-_____ when you focus input field.

If you choose a default placeholder char X, you will have XXXXX-XXXXX

like image 181
JulCh Avatar answered Jan 19 '23 09:01

JulCh