3.1.0 • Published 4 years ago
ng-fad-signed-document v3.1.0
Getting started
Installation
npm install ng-fad-signed-documentDependencies
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 { NgFadSignedDocumentModule } from 'ng-fad-signed-document';
.
.
.
... imports: [
...,
BrowserAnimationsModule
NgFadSignedDocumentModule
]...Note: BrowserAnimationsModule is required.
Usage
HTML
Add the selector inside some component and configure the input parameters:
<ng-fad-signed-document
[configuration]="configuration"
[email]="email"
[emailLimit]="emailLimit"
[canResend]="canResend"
[template]="template"
[showAd]="showAd"
(onsend)="onsend($event)"
(onerror)="onerror($event)"
(onclose)="onclose()"
(oneventprocess)="oneventprocess($event)"
(onclicktemplate)="onclicktemplate()">
</ng-fad-signed-document>Typescript
Listen to the events and execute methods:
public configuration = {};
public email = 'email@example.com';
public emailLimit = 4;
public canResend = true;
template = null;
showAd = false;
@ViewChild(NgFadSignedDocumentComponent) signedDocument: NgFadSignedDocumentComponent;
onerror(error) {
alert(JSON.stringify(error));
}
onsend(emails: string[]) {
// Do something
// if process is correct
this.signedDocument.showSuccess();
}
onclose() {
// Do something after onsend event
}
oneventprocess('SUCCESS_SEND_MAIL' | 'CLOSE_MAILS' | 'OPEN_MAILS') {
// Do something after oneventprocess event
}
onclicktemplate() {
// Do something after onclicktemplate event
}Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| configuration | object | false | {} | module data to be configured |
| string | true | undefined | signer's email displayed on screen | |
| emailLimit | number | false | 6 | limit of emails to resend document |
| canResend | boolean | false | true | option to resend document |
| template | boolean | false | undefined | custom template to display at the end of the component |
| showAd | boolean | false | undefined or false (if template has content) | show notice |
Outputs
| Name | Return | Description |
|---|---|---|
| onerror | object | Is called when an error happens |
| onsend | string[] | Is called when the user continues the process |
| onclose | void | Is called when the user ends the process |
| oneventprocess | Process | Is called when the user has interaction with some elements * |
| onclicktemplate | void | Is called when the user has interaction the ad |
oneventprocess
export enum Process {
SUCCESS_SEND_MAIL = 'SUCCESS_SEND_MAIL',
CLOSE_MAILS = 'CLOSE_MAILS',
OPEN_MAILS = 'OPEN_MAILS'
}SUCCESS_SEND_MAIL: is sent after the method this.signedDocument.showSuccess(); CLOSE_MAILS: is sent when the screen to enter emails is closed OPEN_MAILS: is sent whe the user open the screen to send emails