1.0.0 • Published 2 years ago

ng-fad-identy-face v1.0.0

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

Getting started

Installation

npm install ng-fad-identy-face

Dependencies

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

Configuration project

In angular.json file add identy assets and styles

.
.
"assets": [
    "src/favicon.ico",
    "src/assets",
    {
      "glob": "**/*",
      "input": "projects/ng-fad-identy-face/node_modules/@identy/identy-face/dist/assets",
      "output": "./assets/"
    },
    {
      "glob": "**/*",
      "input": "projects/ng-fad-identy-face/node_modules/@identy/identy-common/dist/assets",
      "output": "./assets/"
    }
  ],
  "styles": [
    "node_modules/@identy/identy-face/dist/identy-face-style.css",
    "node_modules/ng-fad-identy-face/assets/style/fad-identy-face.scss"
  ],
  .
  .

In tsconfig.json or tsconfig.base.json add

{ ... compilerOptions: { ... "skipLibCheck": true, ... } ... }

Import

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

In this case app.module.ts

import { NgFadIdentyFaceModule } from 'ng-fad-identy-face';
.
.
.
... imports: [
       ...,
       BrowserAnimationsModule 
       NgFadIdentyFaceModule
    ]...

Note: BrowserAnimationsModule is required.

Usage

HTML

Add the selector inside some component

<ng-fad-identy-face
  [modelURL]="modelURL"
  (ondata)="ondata($event)"
  (onerror)="onerror($event)">
</ng-fad-identy-face>

Typescript

import { ResponseError, IdentyFace } from 'ng-fad-identy-face';
.
.
.

modelURL: string = 'yor_model_url';

onerror(error: ResponseError) {
  // manage error
}

ondata(event: IdentyFace) {
   // capture result
}

Inputs

NameTypeRequiredDefaultDescription
modelURLstringtrueundefinedServer url
delaynumberfalse5000Set init delay

Outputs

NameReturnDescription
ondataIdentyFaceIs called when capture completes successfully
onerrorobjectIs called when an error happens