I have an input field that takes in an email or phone number. I want to apply UI mask only if phone number is entered but not when alphabets are entered. How can this be achieved?
Asked
Active
Viewed 384 times
0
-
What is a "UI mask"? – HankScorpio Jul 06 '17 at 18:33
-
This post may help https://blog.imaginea.com/pipe-vs-filter-in-angular-js/ – JGFMK Jul 06 '17 at 18:41
-
https://stackoverflow.com/questions/8760070/how-to-format-a-phone-number-with-jquery - you may be able to do it with a helper function in plain old Javascript and Regex's. This might help for alphabetic chars only https://stackoverflow.com/a/25352300/495157 – JGFMK Jul 06 '17 at 18:48
-
1@HankScorpio - UI mask : https://github.com/angular-ui/ui-mask. if my input field is expected to receive only number input - this solution will be perfect http://angular-formly.com/#/example/integrations/ui-mask . – neuronic Jul 06 '17 at 19:04