Question one (formatting telephone number):
I’m having to format a telephone number in AngularJS but there is no filter for it. Is there a way to use filter or currency to format 10 digits to (555) 555-5255? and still preserve the data type of the field as integer?
Question two (masking credit card number):
I have a credit card field that is mapped to AngularJS, like:
<input type="text" ng-model="customer.creditCardNumber">
which is returning the whole number (4111111111111111). I will like to mask it with xxx the first 12 digits and only show the last 4. I was thinking on using filter: limit for this but am not clear as how. Any ideas? Is there a way to also format the number with dashes but still retain the data type as integer? sort of 4111-1111-1111-1111.
Also, if you need to format telephone number on output only, you can use a custom filter like this one:
Then you can use this filter in your template: