I have a tiny directive which simulates 'keydown' event on element click. It works completely fine but I would like like to create a more generic one by having the possibility to pass the 'keydown' value directly from the view.
Could you please help me to understand how the feature works in angular as some of them still bit confusing :) Thanks in advance.
My directive:
app.directive('simulateKeydown', [function(){
return function(scope, element, attr){
var e = jQuery.Event("keydown");
e.which = 36;
element.bind('click', function(){
$(element).trigger(e);
})
}
}])
Current view:
<div simulate-keydown></div>
Desired view:
<div simulate-keydown="36"></div>