I have a basic form input, <input>
. I'd like to make it look nice and neat for phone number entry and tax Id entry. Phone number could be anything like:
xxx.xxx.xxxx
xxx-xxx-xxxx
(xxx) xxx-xxxx
TaxId could include
xxx-xx-xxxx
xx-xxxxxxx
I really don't care which format it is as long as there is a format when someone types in the input box and that the input box will accept nothing but numbers.
Finally, and this is where I've run into trouble, I need to bind the input to ng-model.
I've tried several different plugins but either I don't know how to implement them or I can't bind them to ng-model.
This one seemed most promising but it its binding to ng-model is inconsistent at best and generally seems not to work: https://github.com/mareczek/international-phone-number
<input international-phone-number only-countries="us" type="tel" placeholder="Phone Number" ng-model="user.phone">
When I first did this it seemed that the number was attaching to ng-model but upon further review ng-model in this input remains undefined after inputting a phone number.
It seems like there should be a really simple way to get this done.