Text Input allow only Integer input in angularjs
问题 I want to set the html input[number] <input type="number" /> to allow only integer input (not float). Basically, the html input[number] allow '.' to be entered for float input and I don't want that. Is there a quick way to accomplish it in AngularJS? 回答1: Here is how this can be achieved. With input type - 'text' Directive: app.directive('onlyNumbers', function () { return { restrict: 'A', link: function (scope, elm, attrs, ctrl) { elm.on('keydown', function (event) { if(event.shiftKey){event