Support <div (keyup.enter)="callback">
See original GitHub issueIssue Analytics
- State:
- Created 9 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Angular 2 keyup.enter for div tag - Stack Overflow
(keydown)="handleKeyboardEvent($event,index)" i need to pass some other parameter from html . But when i pass value like this i am getting ...
Read more >.keyup() | jQuery API Documentation
The keyup event is sent to an element when the user releases a key on the keyboard. It can be attached to any...
Read more >Keyboard: keydown and keyup - The Modern JavaScript Tutorial
keyup. Focus on the input field and press a key. ... Special keys are coded by their names: "Enter" , "Backspace" , "Tab"...
Read more >jQuery keyup() Method - W3Schools
The keyup() method triggers the keyup event, or attaches a function to run when a keyup event occurs. Tip: Use the event.which property...
Read more >Element: keydown event - Web APIs | MDN
The keydown and keyup events provide a code indicating which key is pressed, while keypress indicates which character was entered. For example, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve got another idea that I would like to share, since you’re investigating. This probably belongs in a separate issue but it is a scenario particularly relevant with keyboard events, so I’ll start here.
I’ve built apps (Smart TV prototypes) where I wanted to use the scope/context to maintain the life cycle of a key binding, but not bind it to the DOM element that the attribute is used on (I needed it on the document so the handler would trigger regardless of the focused element position). So, the way I approach this in Angular 1.x is write my own directives to bind everything to the document, and use the scope to create/destroy the bindings at appropriate moments.
When I translate my approach to 2.x syntax, it could look like this: (Not sure if you’re still using the
|
character for these situations. I intend it to be the same syntax as for referencing an item in NgRepeat.)In addition, in the case of having multiple bindings with the same key, I often needed a way to distinguish between scenarios where multiple handlers should be called, and scenarios where only the one with the highest priority should be called (in my case the scope that was created last, usually had the highest priority).
In the modal+dropdown example, it would enable you to specify that when pressing
esc
, only the dropdown is closed, and when pressing it again, the modal is closed. In my projects I did this by returning false in the expression, simply because I haven’t thought of anything better yet. It has some resemblance tostopPropagation()
, maybe there’s inspiration to take from that in designing a better syntax.For me, these would be very nice additions to keyboard handling that I would use often. It helped me to keep the controllers very clean, and easily control key binding life cycles even when they’re all on the document.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.