An angular-ui based directive that replaces ng-click for use-cases where user confirmation is needed prior to calling the click handler. Ex: deletes, etc.
Include the confirmationClickDirective.js script in your project. It's defined in module 'app' which it assumes will exist.
-
Add an ng-confirmation-message attribute to the button or link. Set it's value to a string containing the confirmation message to display upon click.
-
Add an ng-confirmation-click attribute to point to your click handler. This handler will only get called if the user accepts the confirmation dialog that will appear.
-
Optionally add an ng-confirmation-title attribute to set the dialog header content
-
Optionally add an ng-confirmation-cancel-click attribute to respond to dialog cancellations
<button ng-confirmation-click="rageQuit()"
ng-confirmation-message="Really rage quit?"
ng-confirmation-title="Decision time"
ng-confirmation-cancel-click="dontRageQuit()"
class="btn btn-danger">Rage quit</button>
ng-confirmation-click: callback function to execute if user accepts confirmation dialogng-confirmation-message: confirmation message to display in dialogng-confirmation-title: (optional) title of confirmation dialog boxng-confirmation-cancel-click: (optional) callback function to execute if user cancels confirmation dialog