Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom dialog as service #8

Closed
giolvani opened this issue Dec 15, 2014 · 1 comment
Closed

Custom dialog as service #8

giolvani opened this issue Dec 15, 2014 · 1 comment

Comments

@giolvani
Copy link

By $ngBootbox service, just alert, confirm and prompt are available, it would be very nice if the custom dialog was available as well...

@eriktufvesson
Copy link
Owner

Hi,

Support for this is now added. You can use it by doing something like this:

$scope.openCustomDialogWithService = function() {
    $ngBootbox.customDialog($scope.customDialogOptions);
  };

  $scope.customDialogOptions = {
      message: 'This is a message!',
      title: 'The best title!',
      onEscape: function() {
          $log.info('Escape was pressed');
      },
      show: true,
      backdrop: false,
      closeButton: true,
      animate: true,
      className: 'test-class',
      buttons: $scope.customDialogButtons
  };

  $scope.customDialogButtons = {
      warning: {
          label: "Warning!",
          className: "btn-warning",
          callback: function() { $scope.addAction('Warning', false); }
      },
      success: {
          label: "Success!",
          className: "btn-success",
          callback: function() { $scope.addAction('Success!', true); }
      },
      danger: {
          label: "Danger!",
          className: "btn-danger",
          callback: function() { $scope.addAction('Danger!', false); }
      },
      main: {
          label: "Click ME!",
          className: "btn-primary",
          callback: function() { $scope.addAction('Main...!', true); }
      }
  };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants