Dialogs
The Dialogs plugin provides access to customize the native device dialogs.
#
InstallationIf you have not already setup Ionic Enterprise in your app, follow the one-time setup steps.
Next, install the plugin:
- Capacitor
- Cordova
#
Index#
Classes#
Interfaces#
Classes#
Dialogsusage:
interfaces: DialogsPromptCallback
#
alert▸ alert(message: string
, title?: string
, buttonName?: string
): Promise
<any
>
Shows a custom alert or dialog box.
Parameters:
Name | Type | Description |
---|---|---|
message | string | Dialog message. |
Optional title | string | |
Optional buttonName | string |
Returns: Promise
<any
>
Returns a blank promise once the user has dismissed the alert.
#
beep▸ beep(times: number
): void
The device plays a beep sound.
Parameters:
Name | Type | Description |
---|---|---|
times | number | The number of times to repeat the beep. |
Returns: void
#
confirm▸ confirm(message: string
, title?: string
, buttonLabels?: string
[]): Promise
<number
>
Displays a customizable confirmation dialog box.
Parameters:
Name | Type | Description |
---|---|---|
message | string | Dialog message. |
Optional title | string | |
Optional buttonLabels | string [] |
Returns: Promise
<number
>
Returns a promise that resolves the button index that was clicked, or 0 if the user has dismissed the dialog by clicking outside the dialog box. Note that the index use one-based indexing.
#
prompt▸ prompt(message?: string
, title?: string
, buttonLabels?: string
[], defaultText?: string
): Promise
<DialogsPromptCallback>
Displays a native dialog box that is more customizable than the browser's prompt function.
Parameters:
Name | Type |
---|---|
Optional message | string |
Optional title | string |
Optional buttonLabels | string [] |
Optional defaultText | string |
Returns: Promise
<DialogsPromptCallback>
Returns a promise that resolves an object with the button index clicked and the text entered
#
Interfaces#
DialogsPromptCallbackDialogsPromptCallback:
#
buttonIndex● buttonIndex: number
The index of the pressed button. (Number) Note that the index uses one-based indexing, so the value is 1, 2, 3, etc.
#
input1● input1: string
The text entered in the prompt dialog box. (String)