使用这个我正在检查右键单击我的按钮如何检查双击我的按钮
`
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}}">
`
dblclick
事件吗!
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();
});
};
});