This package has been deprecated

Author message:

No longer maintained. Install 'angular2-text-mask' without '@msafi/'

@msafi/angular2-text-mask
TypeScript icon, indicating that this package has built-in type declarations

0.7.0 • Public • Published

Angular 2 Input Mask

Getting started

First, install it.

npm i @msafi/angular2-text-mask --save

Then, require it and use it:

import 'es6-shim';
import 'es6-promise';
import 'zone.js/dist/zone';
import 'reflect-metadata';

import {bootstrap} from 'angular2/platform/browser'
import {Component} from 'angular2/core';
import MaskedInput from '@msafi/angular2-text-mask'

@Component({
  selector: 'app',
  templateUrl: `
    <input [textMask]="{mask: '(111) 111 1111'}" [(ngModel)]="myModel" type="text"/>
  `,
  directives: [MaskedInput]
})
export class AppComponent {
  private myModel = ''
}

bootstrap(AppComponent);

Example

TypeScript

You can see a working example in this folder.

Plain JavaScript

For a plain JavaScript example, you can check out this Plunk.

Documentation

As you can see in the example above, you are passing an object to the textMask directive.

For more information about the values that the textMask object accepts, see the documentation here.

License

Public domain - CC0 1.0 Universal

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @msafi/angular2-text-mask

      Weekly Downloads

      17

      Version

      0.7.0

      License

      CC0-1.0

      Last publish

      Collaborators

      • msafi