Angular Ctrl click?

Andres picture Andres · Nov 27, 2014 · Viewed 16.4k times · Source

How can I catch when user press Ctrl click ?

I can do it for single click using:

<input ng-click="some_function()"/>

but I need something like:

<input ng-CTRL-click="some_nice_function()"/>

Is that possible?

Answer

Andy Ecca picture Andy Ecca · Nov 27, 2014

HTML

<input ng-click="some_function($event)"/>

JS

$scope.some_function = function(event){
    if (event.ctrlKey)
    {
       // logic here
    }
}