/** * Created by wisestone on 2017-12-21. */ 'use strict'; define(['app'], function (app) { app.directive('jsShortCut', ["$rootScope", "$log", function ($rootScope, $log) { return { scope : { jsShortCutAction : "&" }, restrict: 'A', link: function (scope, element, attrs) { $(document).unbind("keydown"); $(document).keydown(function (event) { if (event.ctrlKey && event.key === 's') { event.preventDefault(); if ($rootScope.isDefined(scope.jsShortCutAction)) { scope.jsShortCutAction(); } } }); } }; }]) });