Socket
Socket
Sign inDemoInstall

angular-telephone-filter

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    angular-telephone-filter

A simple filter to format of clean a US phone number.


Version published
Weekly downloads
161
decreased by-36.11%
Maintainers
1
Install size
2.03 MB
Created
Weekly downloads
 

Readme

Source

angular-telephone-filter

:phone: 🇺🇸 A simple AngularJS filter to clean or format a US telephone number.

MIT License NPM version

:tv: Demo

Comments and Pull Requests welcome!


Contents

Installation

NPM
$ npm install angular-telephone-filter --save
Bower
$ bower install angular-telephone-filter --save

Or, include the JavaScript file in the head of your document:

<script src="/path/to/file/angular-telephone-filter.js"></script>

Include the module as a dependency of your application:

angular.module('myModule', ['bc.TelephoneFilter']);

Dependencies

  • Angular.js (^1.4.0)

Usage

The filter expects a single parameter to be passed in to control the filter direction. A parameter of clean will return only the numbers (ie 1235551234) while the format parameter will direct the filter to output the formatted number (ie (123) 555-1234);

Use in HTML:
<p>{{'4045551234' | bcTelephone:'format'}}</p>
<!-- Outputs: <p>(404) 555-1234</p> -->

<p>{{'(404) 555-1234' | bcTelephone:'clean'}}</p>
<!-- Outputs: <p>4045551234</p> -->
Use in a controller
function myController($filter) {

  const prettyNumber = '(404) 555-1234';
  $filter('bcTelephone')(prettyNumber, 'clean'); // Output: 4045551234

  const cleanNumber = '4045551234';
  $filter('bcTelephone')(cleanNumber, 'format'); // Output: (404) 555-1234

}

Development

  • npm run build - produces production version of your library under the dist folder
  • npm run dev - produces development version of your library under the dist folder and runs a watcher

Keywords

FAQs

Last updated on 07 Oct 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc