Keypress in Angular-UI

angularjs, html, javascript

Solution

You need to put foo() in quotes.

`<input ui-keypress="{enter: 'foo()'}">`

Problem

I am running into some problems using the keypress as follows- ``` <div ng-controller="GBNController"> ... <input id="search-field" type="text" placeholder="JSON Query" ng-model="queryText" ui-keypress="{enter: foo()}"/> ... </div> ``` and my javascript has - ``` var AngApp = angular.module('gbn', ['ui']); var GBNController = function($scope) { $scope.queryText = ''; $scope.foo = function() { alert('test'); } }; ``` Now this function foo is called only when the document is loaded and then after that, the `return` keypress event in the text field is never handled. I am using the current head of the master branch. Am I doing something wrong here, or is this broken??

Original source