directive for mask ion-input on ionic4
npm install ionic4-mask-directivebash
npm i ionic4-mask-directive --save
`
Import directive
Import the directive into your app module.
`typescript
import { Ionic4MaskDirective } from "ionic4-mask-directive";
@NgModule({
declarations: [
MyApp,
Ionic4MaskDirective,
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
`html
``