AngularJS ng-keypress 指令
AngularJS 教程
· 2019-04-01 19:18:36
AngularJS 实例
按下按键时执行的代码:
<input ng-keypress="count = count + 1" ng-init="count=0" />
<h1>{{count}}</h1>
<h1>{{count}}</h1>
定义和用法
ng-keypress 指令用于告诉 AngularJS 在指定 HTML 元素上按下按键时需要的操作。
ng-keypress 指令不会覆盖元素的原生 onkeypress 事件, 事件触发时,ng-keypress 表达式与原生的 onkeypress 事件将都会执行。
按键敲击的事件顺序:
- Keydown
- Keypress
- Keyup
语法
<element ng-keypress="expression"></element>
<input>, <select>, <textarea>, 和其他可编辑元素支持该指令。
参数值
| 值 | 描述 |
|---|---|
| expression | 按下按键执行的表达式。 |
点击查看所有 AngularJS 教程 文章: https://www.codercto.com/courses/l/36.html
REST in Practice
Jim Webber、Savas Parastatidis、Ian Robinson / O'Reilly Media / 2010-9-24 / USD 44.99
Why don't typical enterprise projects go as smoothly as projects you develop for the Web? Does the REST architectural style really present a viable alternative for building distributed systems and ent......一起来看看 《REST in Practice》 这本书的介绍吧!