0

For example:

<div ui-keydown="'shift-ctrl-alt-65': 'ctrl.scrollFromShortcut($event,\'others\')'"></div>

shift-ctrl-65 is working correctly. But shift-ctrl-alt-65 is not working with ui-keydown. Please help

  • Which version of `angular-ui` you're using? Just tried it with `0.4.0` in a `textarea` and it's working fine. https://jsfiddle.net/2pz2jw6v/1/ – Szabolcs Dézsi Feb 14 '16 at 19:33
  • angular-ui-utils - Swiss-Army-Knife of AngularJS tools (with no external dependencies!) @version v0.1.1 – Shailendra Feb 14 '16 at 19:42
  • Refreshed the jsfiddle: https://jsfiddle.net/2pz2jw6v/3/ with the version you're using. Still working as expected. What if you try adding `tabindex="1"` to the `div`? If this doesn't work, then I have no clue. I'd check the console, maybe there is an exception there. – Szabolcs Dézsi Feb 14 '16 at 20:10
  • Oh, by the way I just noticed that you are missing the `{ .. }` braces around the attribute value. Try it like this: `ui-keydown="{'shift-ctrl-alt-65': 'ctrl.scrollFromShortcut($event,\'others\')'}"` – Szabolcs Dézsi Feb 14 '16 at 20:14
  • Thanks @Szabolcs Dézsi,its working now.after adding {..} – Shailendra Feb 15 '16 at 01:59
  • I'll add it as an answer ;) – Szabolcs Dézsi Feb 15 '16 at 05:47

1 Answers1

0

So as it turned out you were missing the enclosing { ... } curly braces.

The ui-keydown directive expects an object literal where the property name is the key combination and the value is an expression that will be evaluated against the scope.

So the solution is:

<div ui-keydown="{'shift-ctrl-alt-65': 'ctrl.scrollFromShortcut($event,\'others\')'}"></div>
Szabolcs Dézsi
  • 8,743
  • 21
  • 29