Search docs/

Dialogs

v2.0.1

Contents

インストール

Ionic Enterprise Editionのプラグインを利用する場合は、 通常のバージョンでスコープ指定されたプラグインに問題がある可能性があるため、 Ionic Enterprise Cordova CLIを使用していることを確認する必要があります。

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

Ionic Enterprise Cordova CLIをインストールしたら、プラグインをインストールできます。

ionic enterprise register --key=YOURPRODUCTKEYionic 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