VOOZH about

URL: https://www.geeksforgeeks.org/angular-js/angularjs-ng-mousedown-directive/

⇱ AngularJS ng-mousedown Directive - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

AngularJS ng-mousedown Directive

Last Updated : 8 Aug, 2022

The ng-mousedown Directive in AngularJS is used to apply custom behavior when mousedown event occurs on a specific HTML element. It can be used to show a popup alert when the mouse button is pressed down. It is supported by all HTML elements.

Syntax:

<element ng-mousedown="expression"> 
 Contents... 
</element> 

Parameter:

  • expression: When the mouse button is clicked then the expression will be executed.

Example 1: This example uses ng-mousedown Directive to set the style of an element after clicking the mouse. 

Output:

👁 Image
 

Example 2: This example uses the ng-mousedown Directive to display an alert message after clicking the input area. 

Output:

👁 Image
 
Comment

Explore