Fiddle - http://plnkr.co/edit/NizmbUMHblixAUPfQF2G?p=preview
I'm learning AngularJS, and I wanted to try something simple....
Every time I type in a textbox I want to see it's keyCode, (I'm using jQuery in the following function I'm trying to rewrite in this example as jQuery standardizes the keycode event in this case for cross browser consistency)
// Get Keycode/Which
$("[data-action=outputkeycode]").on("keyup", function(e) {
$(this).val(e.which);
}).on("click", function() {
$(this).select();
});
Because I'm trying to update the textbox being typed to find the keyCode I figured I'd apply event.keyCode
in the value, but it's not working.
<body ng-app="">
<input ng-keyup="event=$event" value="{{ event.keyCode }}">
</body>
<!doctype html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js"></script>
</head>
<body ng-app="">
<input ng-keyup="event=$event" value="{{ event.keyCode }}">
</body>
</html>