1.1.0 • Published 7 years ago
ng-allow-input-key v1.1.0
ng-allow-input-key
1. Description
allowInputKey
is a directive for angular 2+ allows input by your pattern.
2. Installation
To install this library, run:
$ npm install ng-allow-input-key --save
3. Usage
Once you have published your library to npm, you can import your library in any Angular application by running:
$ npm install ng-allow-input-key
and then from your Angular AppModule
:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { NgAllowInputKeyModule } from "ng-allow-input-key"; // <--- 1. Import library
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
NgAllowInputKeyModule // <--- 2. Add library to imports
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Once your library is imported, you can use allowInputKey
directive in your Angular application:
<input type="text" [allowInputKey]="pattern">
and add pattern to component:
pattern: RegExp = /[a-z0-9]/;
4. Git repository
https://github.com/ZhyravlevAS/ng-allow-input-key
5. Version
1.1.0
6. License
MIT © Anton Zhyravlev