$event.which provides code to mouse clicks. We can make use of that. Pass $event to function as parameter. 
  • 1 for Left mouse button
  • 2 for Middle mouse button
  • 3 for Right mouse button

Markup

<div ng-mouseup="whichKey($event)">
Mouse click here ( right or left )
</div>

Script

switch ($event.which) {
     case 1:
         alert('Left Mouse button pressed.');
         break;
     case 2:
         alert('Middle Mouse button pressed.');
         break;
     case 3:
         alert('Right Mouse button pressed.');
         break;
     default:
         alert('You have a strange Mouse!');
 }

0 comments:

Blogroll

Follow this blog by Email

Popular Posts