All Downloads are FREE. Search and download functionalities are using the official Maven repository.

app.directives.confirmClick.js Maven / Gradle / Ivy

The newest version!
define([
  'angular',
  'kbn'
],
function (angular) {
  'use strict';

  var module = angular.module('kibana.directives');

  module.directive('confirmClick', function() {
    return {
      restrict: 'A',
      link: function(scope, elem, attrs) {
        elem.bind('click', function() {
          var message = attrs.confirmation || "Are you sure you want to do that?";
          if (window.confirm(message)) {
            var action = attrs.confirmClick;
            if (action) {
              scope.$apply(scope.$eval(action));
            }
          }
        });
      },
    };
  });
});




© 2015 - 2025 Weber Informatics LLC | Privacy Policy