'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'); }; });