AngularJS sgEscape directive for SOGo.UIDesktop
This commit is contained in:
parent
16628ab104
commit
4457997276
|
@ -112,5 +112,20 @@
|
||||||
angular.module('SOGo.UIDesktop', ['mm.foundation'])
|
angular.module('SOGo.UIDesktop', ['mm.foundation'])
|
||||||
|
|
||||||
/* Factory registration in Angular module */
|
/* Factory registration in Angular module */
|
||||||
.factory('sgDialog', Dialog.$factory);
|
.factory('sgDialog', Dialog.$factory)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @desc A directive evaluated when the escape key is pressed.
|
||||||
|
*/
|
||||||
|
.directive('sgEscape', function() {
|
||||||
|
var ESCAPE_KEY = 27;
|
||||||
|
return function (scope, elem, attrs) {
|
||||||
|
elem.bind('keydown', function (event) {
|
||||||
|
if (event.keyCode === ESCAPE_KEY) {
|
||||||
|
scope.$apply(attrs.sgEscape);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in a new issue