forked from Jaware/angular-hotkeys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
37 lines (37 loc) · 1.16 KB
/
example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<html data-ng-app="example">
<head>
<meta charset="UTF-8" />
<title>HotKeys example</title>
<script type="text/javascript" src="bower_components/angular/angular.min.js"></script>
<script type="text/javascript" src="angular-hotkeys.js"></script>
<script>
angular.module('example', ['drahak.hotkeys']).run(function(keyAlias) {
keyAlias['custom'] = 13;
}).controller('Sample', function($scope) {
$scope.text = 'lorem ipsum';
$scope.action = function(e) {
e.preventDefault();
console.log('Hotkey works', e);
};
$scope.message = function(e) {
e.preventDefault();
$scope.text += "AngularJS";
};
$scope.largeMessage = function(e) {
e.preventDefault();
$scope.text += "AngularJS rocks!";
}
});
</script>
</head>
<body data-ng-controller="Sample" hotkey="Custom" invoke="action($event)">
<h1>HotKeys example</h1>
<textarea hotkey="ctrl + a" invoke="message($event)" data-ng-model="text"></textarea>
<textarea hotkey="{
'ctrl + a': message,
'ctrl + shift + a': largeMessage
}" data-ng-model="text"></textarea>
<hotkey bind="ctrl + enter" invoke="action($event)" />
</body>
</html>