The beast's angular Api learning, translating and understanding-keyboard events and mouse events

Source: Internet
Author: User

The beast's Ng API learns--Ngkeydown/ngkeypress/ngkeyup and ngmousedown/ngmouseenter/ngmouseleave/ngmousemove/ngmouseover/ Ngmouseup

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:

<input ng-keydown="Count = Count + 1" ng-init="count=0"> {{count}}

<input ng-keypress="Count = Count + 1" ng-init="count=0">{{count}}

<input 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:

<button ng-mousedown="Count = Count + 1" ng-init="count=0"> on mouse</button>{{count}}

<button ng-mouseenter= "Count = Count + 1"  ng-init = "count=0" >when mouse enter< span class= "tag" ></button>{{count}}

< Span class= "PLN" >< span class= "tag" ><button ng-mouseleave = "Count = Count + 1"  ng-init= "count=0" >when mouse leave </button>{{count}}

<button  ng-mousemove= "Count = count + 1" Span class= "PLN" > ng-init= "count=0" >when mouse move</button> {{count}

<button  ng-mouseover= "Count = Count + 1"  < Span class= "ATN" >ng-init= "count=0" >when  mouse is over</button>{{count}}

<button  ng-mouseup= "Count = Count + 1"  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 ....

Beast's angular Api learning, translating and understanding-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.