Last active
August 29, 2015 14:06
-
-
Save coreyrothwell/8ee18e7b8b1e104e3f83 to your computer and use it in GitHub Desktop.
Angularjs US Phone Filter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
angular.module('whateverApp') | |
.filter('phone', function () { | |
return function (input) { | |
if(!input){ | |
return ''; | |
} | |
return input.replace(/(\d{3})(\d{3})(\d{4})/, '($1) $2-$3'); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment