After a couple of hours, this weird code was the only thing that worked.
I am waiting for the best answers, I will not accept this monster:
app.directive('onKeyup', function() { return function(scope, elm, attrs) { var allowedKeys = scope.$eval(attrs.keys); elm.bind('keydown', function(evt) { angular.forEach(allowedKeys, function(key) { if (key == evt.which) { evt.preventDefault();
and run it using this for all form inputs:
<input on-keyup="bla" keys="[13]" .... />
Now, whenever the user presses the enter key, the window tries to send, and then does not do it, not so quietly. Ugly, but it works.
Edit : keydown is slightly better than keyup to bind an element, now enter the fail silent-ish key
Antonio Max Oct 24 '13 at 0:16 2013-10-24 00:16
source share