Angular--ngkeydown/ngkeypress/ngkeyup keyboard events and mouse events

Source: Internet
Author: User

Ngkeydown/ngkeypress/ngkeyup

The instruction executes the specified expression when the key press/Key Press/Key is released.

Ngkeydown and ngkeypress slightly different, the current test is ngkeypress for the system button is not valid, and Ngkeydown can.

The Ngkeyup command executes when the key is released.

Using code:

  <Inputng-keydown= "Count = Count + 1"  Ng-init=" count=0 " >{{count}} < Input ng-keypress= "Count = Count + 1"  Ng-init= "count=0" > {{count}} <input Span style= "color: #ff0000;" >ng-keyup= "Count = Count + 1"  Ng-init= "count=0" >{{count}}         

Ngmousedown/ngmouseenter/ngmouseleave/ngmousemove/ngmouseover/ngmouseup

The instruction executes the specified expression when the mouse is pressed/the mouse enters/the mouse is left/the mouse moves/the mouse is on the top/mouse is released.

Using code:

  <buttonNg-mousedown= "Count = Count + 1"Ng-init= "Count=0">on Mouse Down</button>{{count}}<buttonNg-mouseenter= "Count = Count + 1"Ng-init= "Count=0">when Mouse Enter</button>{{count}}<buttonNg-mouseleave= "Count = Count + 1"Ng-init= "Count=0">when Mouse Leave</button>{{count}}<buttonNg-mousemove= "Count = Count + 1"Ng-init= "Count=0">when Mouse Move</button>{{count}}<button = "Count = Count + 1"  Ng-init= "count=0" >when Mouse is Over</button>{{count}}  <button ng-mouseup Ng-init=" count=0 ">on mouse Up</button >{{count}}            

 

I didn't want to write these instructions, after all, it was a little bit simpler ...   then think back, maybe sometimes the project needs to be used, or the use of these instructions is summed up ....

Angular--ngkeydown/ngkeypress/ngkeyup keyboard events and mouse events

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.