In my angular view, I am using directive to render an input field and it works fine. But now I required to perform some action on keydown.
ng-keydown works fine with the input field I have in my view:
<input ng-keydown="tabed($event)" ng-model="myData2"/>
but it is not working with the input field which is rendered via directive
<my_input input-value="mydata"></my_input>
Directive:
app.directive('myInput', function () {
return {
restrict: 'EA',
template: '<input ng-keydown="tabed($event)" ng-model="inputValue"/>',
scope: {
inputValue: '=',
inputName: '='
},
link: function (scope) {
}
};
});
I have tried a lot but did not found any way to trigger keydown event on input field rendered via directive.
Here is the Fiddle