Dialogs
$ ionic plugin add cordova-plugin-dialogs
Repo: https://github.com/apache/cordova-plugin-dialogs.git
This plugin gives you ability to access and customize the device native dialogs.
Requires Cordova plugin: cordova-plugin-dialogs
. For more info, please see the Dialogs plugin docs.
Usage
import {Dialogs} from 'ionic-native';
Static Methods
alert(message, title, buttonName)
Shows a custom alert or dialog box.
Param | Type | Details |
---|---|---|
message |
Dialog message. (String) |
|
title |
Dialog title. (String) (Optional, defaults to Alert) |
|
buttonName |
Button name. (String) (Optional, defaults to OK) |
Returns:
Promise<any>
Returns a blank promise once the user has dismissed the alert.
confirm(message, title, buttonLabels)
Displays a customizable confirmation dialog box.
Param | Type | Details |
---|---|---|
message |
Dialog message. (String) |
|
title |
Dialog title. (String) (Optional, defaults to Confirm) |
|
buttonLabels |
Array of strings specifying button labels. (Array) (Optional, defaults to [OK,Cancel]) |
Returns:
Promise<number>
Returns a promise that resolves the button index that was clicked. Note that the index use one-based indexing.
prompt(message, title, buttonLabels, defaultText)
Displays a native dialog box that is more customizable than the browser’s prompt function.
Param | Type | Details |
---|---|---|
message |
Dialog message. (String) |
|
title |
Dialog title (String) (Optional, defaults to Prompt) |
|
buttonLabels |
Array of strings specifying button labels (Array) (Optional, defaults to ["OK","Cancel"]) |
|
defaultText |
Default textbox input value (String) (Optional, Default: empty string) |
Returns:
Promise<any>
Returns a promise that resolves an object with the button index clicked and the text entered
beep(times)
The device plays a beep sound.
Param | Type | Details |
---|---|---|
times |
The number of times to repeat the beep. (Number) |