ons-alert-dialog


  • Onsen UI

    Alert dialog that is displayed on top of the current screen. Useful for displaying questions, warnings or error messages to the user. The title, content and buttons can be easily customized and it will automatically switch style based on the platform. To use the element it can either be attached directly to the <body> element or dynamically created from a template using the ons.createAlertDialog(template) utility function and the <ons-template> tag.

    Click here to see the original article



  • this is incorrect.

      confirm() {
        onsNotification.confirm({
          message: 'This dialog can be canceled by tapping the background or using the back button on your device.',
          cancelable: true,
          callback: i => {
            if (i == -1) {  // here this is not cancelled.  1 is correct.
              onsNotification.alert({message: 'You canceled it!'});
            }
          }
        });
      }
    

  • Onsen UI

    @koheiokazaki -1 is returned when you set cancelable attribute and you tap the background or use the back button. +1 is just the index of the button. In this case the button is “Cancel” but you could change it to anything else.



  • I have a question.

    I wanna change confirm message “cancel” and “OK” , is this can that?



  • sorry I can do that…

    buttonLabels: [‘No’, ‘Yes’]


Log in to reply