Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

ons.notification


  • Onsen UI

    Utility methods to create different kinds of alert dialogs. There are three methods available:

    • ons.notification.alert()
    • ons.notification.confirm()
    • ons.notification.prompt()

    It will automatically display a Material Design dialog on Android devices.

    Click here to see the original article



  • I’m not sure if this is inherently known, but it’s important to note that when using the confirm notification, we must know which option the user has chosen to execute logic based on the response. In the options.callback we need to identify (document) the parameter for a positive or negative response. Such as:

    options: {
      callback: function(isOkChosen) {
        if (isOkChosen)  {  } else { } 
      }
    }
    


  • why is there no callback option for notification.prompt? how do you get the string that the user entered?


  • Onsen UI

    @jpwright It has options.callback. The description says Extends alert() parameters., which means that it implements all the parameters of ons.notification.alert plus its own paramenters. It also returns a promise with the string, which can be used instead of the callback.