Comments (3)
Try putting it on the <body>
tag.
from ui-utils.
Hi,
Thanks for your answer.
I can't do this because I don't wan't those shortcuts to be activated on every view of my app, only in a specific view, so I would like the directive to be inside this specific view, on a div for instance or any other tag on this view.
Since I didn't manage to use ui-keypress, I move to mousetrap.js
If I found a way to use ui-keypress for my need, I will use it because mousetrap.js is not angular 'ready', so I need to add a few $scope.$apply() in my code and I prefer to avoid this.
Regards,
from ui-utils.
@clakech You can use ui-keypress on div element by having tabindex="0" attribute on that div. Checkout http://stackoverflow.com/questions/148361/how-can-i-give-keyboard-focus-to-a-div-and-attach-keyboard-event-handlers-to-it and http://www.w3.org/WAI/GL/WCAG20/WD-WCAG20-TECHS/SCR29.html for more information on tabindex.
e.g.
<div style="outline: 0; border: 1px solid red;" tabindex="0" ui-keypress="{13:'keypressCallback($event)'}">
Click inside this div and hit [Enter]. You can make any element accept keyboard event by adding tabindex="0" attribute to the element.
</div>
I'll create a PR with this updated example.
from ui-utils.
Related Issues (20)
- HELP(ui-jq)TypeError: Cannot read property 'apply' of undefined HOT 3
- Please add ignore field to bower.json HOT 1
- uiScroll keeps loading data indefinitely HOT 1
- uiScroll: horizontal scrolling? HOT 1
- ui-scroll [TypeError: Cannot read property 'length' of null] when leaving the view with the scroll HOT 2
- UI-Scroll how to make the first record appear? HOT 1
- UI-Scroll how to call revision function manully ? HOT 2
- ui-mask: erratic behaviour when user types wrong mask (chrome 43 & firefox 38) HOT 1
- Update bower references to use bower registry names HOT 2
- Demo page issues / where are the old modules HOT 4
- ui-jq HOT 4
- Bower 2.0.0 version does not contain build HOT 2
- Bower install does not contain dist any more HOT 2
- unique filter HOT 1
- ui.keypress not add bower. HOT 3
- Can we get ui-highlight back? HOT 2
- I am using ui-mask and the value for 9 gets replaces for all number 1-9(digits). how can i just restrict mask to have only 9 as a value
- validation problem when try to put a part of value of the mask HOT 1
- Please publish all version to NPM HOT 2
- Do not support import? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ui-utils.