EvanModalService

Source modal

Service that handles components within modals.


createModal

modalService.createModal(arguments);

Creates a modal using an component.

Parameters

  1. component - Component: component to show in the modal
  2. payload - any: payload that should be applied to the component[this]
  3. evanModalAnimation - boolean: a modal dialog that uses .evan-modal internally

Returns

Promise returns any: modal that is resolved on modal reject / resolve

Component

Each component that is used within this service needs to be added to your modals “entryComponents”. The AngularCore module specifies the following components that can be used by default of your application:

Each component instance gets the following parameters applied, after it was created:

  • resolveDialog - Function: Function to close the modal and resolves the promise as successfull
  • rejectDialog - Function: Function to close the modal and rejects the promise as an error

In addition, all parameters and their values are transferred from the payload object to the component instance.

Example

Reference Implementation:

showMailModal(
  modalService: EvanModalService,
  alertTitle: string,
  alertText: string,
  title: string,
  body: string
): Promise<any> {
  return modalService.createModal(MailDialogComponent, {
    alertTitle,
    alertText,
    title,
    body
  }, true);
}

showBigPicture

modalService.showBigPicture(alertTitle, alertText, img);

Modal wrapper for the angular-core BigPictureDialog Component.

Parameters

  1. alertTitle - string: title of the alert
  2. alertText - string: text of the alert
  3. img - string: url / base64 of a img

Returns

Promise returns any: modal that is resolved on modal reject / resolv

Example

Reference Implementation: Task DApp

try {
  return this.modalService.showBigPicture(
    'alertTitle',
    'alertText',
    dataUrl,
  );
} catch (ex) { }