简体   繁体   English

在非输入html标记上使用ng-keyup

[英]Using ng-keyup on non-input html tags

I have to use ng-keyup on some arrow keys. 我必须在某些箭头键上使用ng-keyup。 i am only able to use it on textarea and input type="text" tags. 我只能在textarea上使用它,并输入type="text"标签。

I want to be able to use it on a div or body tag rather than the input tags so the user can just press arrow key when page loads to see the change. 我希望能够在div或body标签上而不是在输入标签上使用它,以便用户可以在页面加载时按箭头键来查看更改。 How do I do this? 我该怎么做呢?

Using AngularJS ngKeyup on a div rather than an input 在div而不是输入上使用AngularJS ngKeyup

I already tried using tabindex as is suggested by this answer but it didn't work. 我已经尝试过根据该答案的建议使用tabindex,但是它没有用。

通过将controller和ng-keyup都移到body标签上来工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM