You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//if you have a directive that sets up a DOM event listener and changes some models inside the handler function, you need to call $apply() to ensure the changes take effect.
16
+
// Saves the counter
17
+
$scope.count=0;
18
+
// Saves out the letters
19
+
$scope.key='none';
20
+
// Saves the keycode
21
+
$scope.lastKey='';
22
+
23
+
// Increment function
24
+
$scope.increment=function(){
25
+
$scope.count++;
26
+
};
27
+
28
+
$scope.keypress=function($event){
29
+
varkey=$event.keyCode,
30
+
string=String.fromCharCode(key);
31
+
$scope.increment();
32
+
33
+
if(keyObj[key]){
34
+
$scope.lastKey=keyObj[key];
35
+
}else{
36
+
$scope.lastKey=string;
37
+
}
38
+
};
39
+
40
+
// angular.elemnt wraps a raw dom element or html string as a jQeruy element.
//if you have a directive that sets up a DOM event listener and changes some models inside the handler function, you need to call $apply() to ensure the changes take effect.
47
44
$scope.$apply($scope.keypress(event));
48
-
//grab the class name the keyCode class name, then add a class to it.
0 commit comments