2.2.0 • Published 2 years ago

ng-fad-security-code-desktop v2.2.0

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Getting started

Installation

npm install ng-fad-security-code-desktop

Dependencies

Add the folder provided by the technical team within the project assets (images and js)

Import

In the file necessary example.module.ts import the module.

In this case app.module.ts

import { NgFadSecurityCodeDesktopModule } from 'ng-fad-security-code-desktop';
.
.
.
... imports: [
       ...,
       BrowserAnimationsModule 
       NgFadSecurityCodeDesktopModule
    ]...

Note: BrowserAnimationsModule is required.

Usage

HTML

Add the selector inside some component and configure the input parameters:

  <ng-fad-security-code-desktop
    #securityCodeModule
    [configuration]="configuration"
    [canResendCode]="canResendCode"
    [currentPhone]="currentPhone"
    [securityLength]="securityLength"
    [securityType]="securityType"
    (onerror)="onerror($event)"
    (onresendcode)="onresendcode()"
    (onsendcode)="onsendcode($event)">
  </ng-fad-security-code-desktop>

Typescript

Listen to the events and execute methods:

  import { NgFadSecurityCodeComponent } from 'ng-fad-security-code/public-api';
  .
  .
  .

  @ViewChild('securityCodeModule') securityCodeModule: NgFadSecurityCodeComponent;
  public securityType = 'SMS' | 'PHONE_NUMBER';
  public currentPhone = '5555555555';
  public securityLength = 4;
  public canResendCode = true;

  onsendcode(code: string) {
   // captured code
   alert(code)
  }

  onerror($event) {
    // some error
    alert(JSON.stringify(error));
  }

  setError() {
    // set error to true when the validation of the security code is wrong
    this.securityCodeModule.setError(true);
  }

Inputs

NameTypeRequiredDefaultDescription
configurationobjectfalse{}module data to be configured
securityTypestringtrue'SMS'type of code to be entered
currentPhonestringtrue (if securityType === 'SMS')undefineduser's phone to paint on screen
securityLengthnumbertrue4security code length
canResendCodebooleanfalseundefinedoption to resend code
oneInputLengthnumberfalse255Max length of input (only use in securityType === SECRET_WORD')

Outputs

NameReturnDescription
onsendcodestringIs called after the user captured the security code
onerrorobjectIs called when an error happens
onresendcodevoidIs called when the user clicks on the text of resend code
2.2.0

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago