I want to catch the enter key press event on the textbox below. To make it more clear I am using a ng-repeat
to populate the tbody. Here is the HTML:
<td><input type="number" id="closeqty{{$index}}" class="pagination-right closefield"
data-ng-model="closeqtymodel" data-ng-change="change($index)" required placeholder="{{item.closeMeasure}}" /></td>
This is my module:
angular.module('components', ['ngResource']);
I am using a resource to populate the table and my controller code is:
function Ajaxy($scope, $resource) {
//controller which has resource to populate the table
}
You need to add a
directive
, like this:Javascript:
HTML:
Another simple alternative:
And the ng-ui alternative:
You can use ng-keydown ="myFunction($event)" as attribute.
I think using document.bind is a bit more elegant
To get document to the controller constructor:
How about just