Using this I am checking for a right click on my button. How can I check for a double click on my button?
app.directive('rightClick', function ($parse, $mdMenu) {
return function (scope, element, attrs) {
var fn = $parse(attrs.rightClick);
element.on('contextmenu', function (event) {
event.preventDefault();
scope.$apply(function () {
fn(scope, { $event: event });
});
event.stopPropagation();
});
};
});
<button right-click="$mdMenu.open($event)" id="{{element.id}}">
Could you try listening for the dblclick
event!
html
<button double-click="$ctrl.alertClick()" id="test">{{$ctrl.name}}</button>
js
window.app.directive('doubleClick', function ($parse) {
return function (scope, element, attrs) {
var fn = $parse(attrs.doubleClick);
console.log(attrs.doubleClick);
element.on('dblclick', function (event) {
console.log('click');
event.preventDefault();
scope.$apply(function () {
fn(scope, { $event: event });
});
event.stopPropagation();
});
};
});