You can get the time between mousedownand mouseupto determine if a click or text is selected.
Also:
Demo
(function(){
angular.module("app", []);
angular.module("app")
.directive("noclick", function(){
return {
restrict: "A",
link: function(scope, element, attr){
scope.time= Date.now();
element.on("mousedown mouseup", function(e){
if(e.type == "mousedown"){
scope.time= Date.now();
}
if(e.type == "mouseup"){
if(Date.now() - scope.time> 300){
return false;
}else{
console.log("clicked");
}
}
});
}
}
});
})(window, angular);
Note. I use the directive for this case.
source
share