EvanModalService¶
Source | modal |
---|
Service that handles components within modals.
createModal¶
modalService.createModal(arguments);
Creates a modal using an component.
Parameters¶
component
-Component
: component to show in the modalpayload
-any
: payload that should be applied to the component[this]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:
MailDialogComponent
GlobalPasswordComponent
TrustDialogComponent Component
SnapshotDialogComponent Component
QRCodeScannerDialogComponent Component
BigPictureDialog Component
Each component instance gets the following parameters applied, after it was created:
resolveDialog
-Function
: Function to close the modal and resolves the promise as successfullrejectDialog
-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:
- fullscreen modal component
GlobalPasswordComponent
- fullscreen modal component
GlobalPasswordComponent
- modal style component
MailDialogComponent
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¶
alertTitle
-string
: title of the alertalertText
-string
: text of the alertimg
-string
: url / base64 of a img
Returns¶
Promise
returns any
: modal that is resolved on modal reject / resolv