kibana-riya
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
24 lines (22 loc) • 597 B
JavaScript
import uiModules from 'ui/modules';
uiModules
.get('kibana')
.directive('confirmClick', function () {
return {
restrict: 'A',
link: function ($scope, $elem, attrs) {
$elem.bind('click', function () {
let message = attrs.confirmation || 'Are you sure?';
if (window.confirm(message)) { // eslint-disable-line no-alert
let action = attrs.confirmClick;
if (action) {
$scope.$apply($scope.$eval(action));
}
}
});
$scope.$on('$destroy', function () {
$elem.unbind('click');
});
},
};
});