Socket
Socket
Sign inDemoInstall

angular1-text-mask

Package Overview
Dependencies
0
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    angular1-text-mask

Angular 1 directive for input text masking


Version published
Weekly downloads
769
decreased by-24.01%
Maintainers
2
Install size
115 kB
Created
Weekly downloads
 

Readme

Source

Angular Input Mask

Getting started

First, install it.

npm i angular1-text-mask --save

Then, use it as follows:

<script
  type="text/javascript"
  src="./node_modules/angular1-text-mask/dist/angular1TextMask.js"></script>
<script type="text/javascript">
  // First add Text Mask as a module
  angular
    .module('app', ['text-mask'])

    // Then use it in your Angular1 component as such
    .component('app', {
      controller: 'DemoController as $ctrl',
      template: '<input text-mask="$ctrl.textMaskConfig" ng-model="$ctrl.myModel" type="text"/>'
    })
    .controller(function() {
      var vm = this
  
      this.myModel = ''
      this.modelWithValue = '5554441234'
  
      this.textMaskConfig = {
        mask: ['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]
      }
    })
</script>

Documentation

As you can see in the code above, you are passing an object to the text-mask directive.

For more information about the values that the text-mask object accepts, see this page.

Example

To see an example of a minimal app running with this directive, follow these steps:

  1. Clone the repo, git clone git@github.com:text-mask/text-mask.git
  2. cd text-mask
  3. npm install
  4. npm run angular1:dev
  5. Open http://localhost:3000

The code of the example is in angular1/example.

FAQs

Last updated on 07 May 2018

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