@spalger/kibana
Version:
Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elastic
25 lines (23 loc) • 647 B
JavaScript
define(function (require) {
require('ui/modules')
.get('kibana')
.directive('confirmClick', function () {
return {
restrict: 'A',
link: function ($scope, $elem, attrs) {
$elem.bind('click', function () {
var message = attrs.confirmation || 'Are you sure?';
if (window.confirm(message)) { // eslint-disable-line no-alert
var action = attrs.confirmClick;
if (action) {
$scope.$apply($scope.$eval(action));
}
}
});
$scope.$on('$destroy', function () {
$elem.unbind('click');
});
},
};
});
});