File tree 1 file changed +22
-20
lines changed
content/docs/en/elements/dialogs
1 file changed +22
-20
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
title : ConfirmDialog
3
3
apiRef : https://docs.nativescript.org/api-reference/modules/_ui_dialogs_#confirm
4
- contributors : [MisterBrownRSA, rigor789]
4
+ contributors : [MisterBrownRSA, rigor789, ikoevska ]
5
5
---
6
6
7
- The ConfirmDialog acts as a boolean (Yes/No) input dialog.
7
+ The ` confirm() ` method shows a confirmation message and Cancel and OK buttons.
8
+
9
+ The method is part of the [ ` dialogs ` module] ( https://docs.nativescript.org/api-reference/modules/_ui_dialogs_ ) .
8
10
9
11
---
10
12
13
+ ## Basic use
14
+
15
+ The ` confirm() ` method is available globally. You can call it anywhere in your app.
16
+
11
17
``` javascript
12
- const dialogs = require (' tns-core-modules/ui/dialogs' )
13
-
14
- module .exports = {
15
- mounted () {
16
- dialogs .confirm (' Are you ready?' )
17
- .then (result => {
18
- console .log (result)
19
- })
20
- }
21
- }
18
+ confirm (' Your message' )
19
+ .then (result => {
20
+ console .log (result);
21
+ });
22
22
```
23
23
24
- The ConfirmDialog is also available globally, so instead of importing it from the dialogs module, you can simply call
24
+ ## Configure dialog options
25
25
26
26
``` javascript
27
- confirm (' Are you ready?' )
28
- .then (result => {
29
- console .log (result)
30
- })
27
+ confirm ({
28
+ title: " Your title" ,
29
+ message: " Your message" ,
30
+ okButtonText: " Your OK button text" ,
31
+ cancelButtonText: " Your Cancel text"
32
+ }).then (result => {
33
+ console .log (result);
34
+ });
31
35
```
32
36
33
- anywhere in your code.
34
-
35
- [ > screenshots for=ConfirmDialog <]
37
+ [ > screenshots for=ConfirmDialog <]
You can’t perform that action at this time.
0 commit comments