-
Notifications
You must be signed in to change notification settings - Fork 27.5k
angular/angular.js#1035 added ng-keyup and ng-keydown and tests #1622
Conversation
Bah - realized I didn't update ngdoc. Let me know if I need to add that and resubmit. |
@digger69 Thnx for the PR! It looks like it will require some more work before it can be merged:
But, the most important thing is that I wonder if the key-up / key-down directives shouldn't support some syntax to specify on which key we want to react. Of course it could be tested with the |
thanks - I'll update my pull request for docs and fix the commit messages. I don't think the directive should support which key to react to. I believe interrogating event in the handler is the correct pattern. This is consistent w/ the mouse events where similar considerations for modifiers (alt/ctrl) or buttons could be considered. |
@digger69 great, thnx! As for the directive syntax / usage I hear what you are saying. Posted a quick message on the google group to get some feedback from the community: https://groups.google.com/forum/#!topic/angular/_XZpuDRSoJ8 |
New directives for binding to keydown and keyup events. Closes #1035
I updated the docs and fixed the commit message and tried to squash it all. Let me know how it looks. Thanks! |
LGTM ui-keypress is quite a beast. I don't think that it belongs to the core. we can always improve ng-keyXXX if we see that it's critical. I personally think that it's pretty obscure (I'd rather write a custom directive than use ng-keyXXX), but since the weight of the change in bytes is minimal, I'm ok with merging this in. |
Thanks. I like the light-weight version compared to ui-keypress as well, so looking forward to this getting in. |
Since this will not be going into the core, anyone coming across this ticket and still wants this functionality: Go checkout AngularUI Keypress |
I believe the intent is that this light weight directive ng-keydown will be merged into the core. The ui-keypress won't but certainly can be used independently if the extended functionality is needed. Thanks for the link ProLoser |
Landed as e03182f. Thank you! |
Is there a reason for not adding keypress as well (I'm talking about the dom event, not the UI component) ? If not, can I open a new pull request ? |
@arcanis no reason, just an oversight - frankly wasn't sure what the difference was between keydown and keypress until your question prompted my search :) |
+1 on this pull request, since almost all the dom's events are mapped into core directives, I don't see why this one shouldn't. Keys events are usefull as the Mouse events, it makes sense to have both. |
Can information on these directives be added to the API docs. I think most people are unaware this feature exists. I didn't see anything about it on the angularjs.org |
Yeah, I'm fuddled as to why it isn't showing up. I see the ngdoc reference in the source: |
I had a need for keyup as well as others described in issue #1035