How to detect pressed keys on the click of AngularJS

后端 未结 5 1577
渐次进展
渐次进展 2021-02-07 00:44

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 so

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-07 01:33

    In your html

    
    

    In your js

    $scope.doSomething = function($event)
    {
    if ($event.altKey){}
    if ($event.ctrlKey){}
    if ($event.shiftKey){}
    }
    

提交回复
热议问题