I'm using angularjs on a web application that I need to figure out how can I detect is keys like ctrl, shift or alt are pressed when I click somewhere.
例如,使用 jQuery,我可以通过访问 Click 函数参数来做到这一点。
是否有一些开箱即用的方法来获取有关角度的信息?
在你的html中
<button ng-click="doSomething($event)"></button>
在你的js中
$scope.doSomething = function($event)
{
if ($event.altKey){}
if ($event.ctrlKey){}
if ($event.shiftKey){}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)