SmartIT_Extensions/BMC/smart-it-full-helix/scripts/app/common/element-focus-service.js

22 lines
741 B
JavaScript

"use strict";
/**
* Created by prenge on 19-08-2019.
*/
(function () {
'use strict';
angular.module('myitsmApp')
.factory('elementFocus', ["$timeout", "$window", function ($timeout, $window) {
return function (id) {
// timeout makes sure that it is invoked after any other event has been triggered.
// e.g. click events that need to run before the focus or
// inputs elements that are in a disabled state but are enabled when those events
// are triggered.
$timeout(function () {
var element = $window.document.getElementById(id);
if (element)
element.focus();
});
};
}]);
}());