ionic2-mask-directive
directive for mask ion-input on ionic2
Last updated 2 years ago by hayko .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ionic2-mask-directive 
SYNC missed versions from official npm registry.

ionic2-mask-directive

Ionic2MaskDirective help you add mask on ion-input with just a directive and a very simple configuration.

Install

npm i ionic2-mask-directive --save

Import directive

Import the directive into your app module.

import {Ionic2MaskDirective} from "ionic2-mask-directive";

@NgModule({
    declarations: [
        MyApp,
        Ionic2MaskDirective,
        HomePage
    ],
    imports: [
        BrowserModule,
        IonicModule.forRoot(MyApp),
        HttpModule
    ],
    bootstrap: [IonicApp],
    entryComponents: [
        MyApp,
        HomePage
    ],
    providers: [
        StatusBar,
        SplashScreen,
        {provide: ErrorHandler, useClass: IonicErrorHandler}        
    ]
})
export class AppModule {
}

Usage

To configure the mask, you can use 3 types of characters.

  • # - any type of char;
  • 9 - only numbers;
  • A - only letters;

Example

<!-- phone number in Brasil -->
<ion-input type="text" mask="(99) 9999-9999" placeholder="Phone" [(ngModel)]="user.phone" required></ion-input>
<!-- brasilian document -->
<ion-input type="text" mask="999.999.999-99" placeholder="CPF" [(ngModel)]="user.document" required></ion-input>

Contribute

Any pull-request and issue is more than welcome.

License

The MIT License (MIT) Copyright (c) 2013

Current Tags

  • 1.0.8                                ...           latest (2 years ago)

9 Versions

  • 1.0.8                                ...           2 years ago
  • 1.0.7                                ...           2 years ago
  • 1.0.6                                ...           2 years ago
  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 24
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |