angular7-pincode

a simple directive for otp input template like on mobile otp input template

Usage no npm install needed!

<script type="module">
  import angular7Pincode from 'https://cdn.skypack.dev/angular7-pincode';
</script>

README

Angular Custom OTP Input-Template

Custom otp-input template for Angular, it look likes otp-input template as mobile.

Table of Contents

Installation

NPM

npm i -S angular7-pincode

Usage

Import Angular7PincodeModule in your module

import { Angular7PincodeModule } from 'angular7-pincode';

@NgModule({
  imports: [
    // ...
    Angular7PincodeModule
  ]
})

In your template

<angular7-pincode >
</angular7-pincode>

Options

directive inputs

  • [size]: number length of otp input, default 4

  • [class]: string your custom class on otp input

Callback functions

  • (onFullFill): function return a otp string on every keypress

examples

default settings

<angular7-pincode (onFullFill)="onFullFill($event)">
</angular7-pincode>
onFullFill(data:any){
  console.log(data)
}

with size and custom class option

<angular7-pincode [size]="6" [class]="your-class" (onFullFill)="onFullFill($event)">
</angular7-pincode>
onFullFill(data:any){
  console.log(data)
}

Issues

If you identify any errors in the library, or have an idea for an improvement, please open an issue.

Author