Dialogs

v2.0.1

Contents

Installation

In order to use Ionic Enterprise Edition plugins you should make sure you're using the Ionic Enterprise Cordova CLI as the regular version can have issues with scoped plugins.

npm uninstall -g cordova npm install -g @ionic-enterprise/cordova

Once you've installed the Ionic Enterprise Cordova CLI you can install the plugin.

ionic enterprise register --key=YOURPRODUCTKEY ionic cordova plugin add @ionic-enterprise/dialogs

Index

Classes

Interfaces


Classes

Dialogs

Dialogs:

name: Dialogs

description: This plugin gives you ability to access and customize the device native dialogs.

usage:

import { Dialogs } from '@ionic-enterprise/dialogs/ngx';

constructor(private dialogs: Dialogs) { }

...

this.dialogs.alert('Hello world')
  .then(() => console.log('Dialog dismissed'))
  .catch(e => console.log('Error displaying dialog', e));

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

DialogsPromptCallback

DialogsPromptCallback:

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)



Other Versions