I'm trying to get angular-ui ui-keypress to call a function when the down key is pressed. From what I've found the down key is code number 40. However I'm unable to trigger the event.
If you look at this jsfiddle which triggers a function on the ENTER keypress (try enter or even 13). But if you change that to 40 it doesn't work. http://jsfiddle.net/jayrmotta/NbjZL/70/
<!DOCTYPE html>
<html ng-app="myModule" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Main</title>
</head>
<body ng-controller="Ctrl">
<button ng-click="add()">Add</button>
<input type="text" ui-keypress="{40: 'add()'}" />
{{item}}
</body>
</html>
var myModule = angular.module('myModule', ['ui.directives']);
function Ctrl($scope) {
$scope.item = "";
$scope.add = function () {
$scope.item = "Item Added";
}
}
Do I have the wrong code or can any tell me what's wrong?