-
Notifications
You must be signed in to change notification settings - Fork 27.5k
add ng-keyup and ng-keydown #1035
Comments
Hi Carles, can you briefly describe how you use these events? We haven't had the need for them because we always rely on model data-binding. |
Hi Igor My reason for asking for this two directives is to improve code readability. I would like to use this 'ng-keyup' on a custom auto complete directive that needs to connect with the server every time a new character is typed. I could rely on data binding (scope.$watch) but, don´t you think it would make the html more readable to use ng-keyup' on the template of the directive? If a developer sees a input tag like '', he would never expect that everytime you type a character, you are connecting to the server to retrieve all the matching names. But if instead you have '', it´s much easier to understand what´s happening. I also think that's a little confusing to have a ng-mouseup directive and not a ng-keyup directive. For a new developer that comes to angular and doesn´t understand the data binding completely, it can be frustrating (or at least that´s what my collegues told me when I told them to use scope.$watch instead). Carles. |
Navigating trough the autosuggestion list using arrow keys may be a usecase. It would also be nice to be able to dispatch based on keycode values or friendlier aliases. |
I think it would be very nice because I'd like to execute an action after a user has hit the enter key in an input box |
Another use case I'm implementing right now is keyboard shortcut keys in a web application. Feels very hack-y to do pure jQuery event handling of keydown/keyup in my directive - would much prefer that these two events were defined as directives. |
Im doing a chat application and i want to submit the message on enter when the user hits it in the textarea. If he hits shift + enter i want to add a linebreak in the textarea. |
Since this will not be going into the core, anyone coming across this ticket and still wants this functionality: Go checkout AngularUI Keypress |
…eydown and keyup events. Closes angular#1035
Is there a reason that ng:keypress was not added? Seems like you're stopping just before the finish line... |
Hi Dean, oversight really. No reason could't add as additional PR. |
I've already got it in AngularUI. It will be up to someone else to add this. |
+1 or ng:keypress -- no rational reason to omit right? |
done #2101 |
Can you guys please add the ng-keydown and ng-keydown directives
I Think it would be extremely easy to add both directives to angular since you already have this generic mechanism to create 'event directives'
The only think to do is on line 12294 of angular-1.0.0rc10.js
add the two new events
I´ve tryied on my machine and it works perfectly.
Thanks for the effort on angular.
Carles.
The text was updated successfully, but these errors were encountered: