JSFiddle - React, Tailwind, and code Playground
by nikhiltnair
HTML
<div ng-app='MyModule' ng-controller="MyController">
Directive: <my_input input-value="mydata"></my_input> {{mydata}} <br/>
Normal: <input ng-keydown="tabed($event)" ng-model="myData2"/> {{myData2}}
</div>
JavaScript
var app = angular.module('MyModule', []);
app.controller('MyController', function( $scope ) {
$scope.tabed = function (e) {
console.log("e is ", e);
}
});
app.directive('myInput', function () {
return {
restrict: 'EA',
template: '<input ng-keydown="$parent.tabed($event)" ng-model="inputValue"/>',
scope: {
inputValue: '=',
inputName: '='
},
link: function (scope) {
}
};
});