sogo/UI/WebServerResources/js/Common/sgFocus.service.js
Francis Lachapelle 1dc5f0d412 (js) New file structure for Angular modules
JavaScript files are now merged by the 'js' Grunt task.
2015-06-12 12:01:21 -04:00

26 lines
649 B
JavaScript

/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
(function() {
'use strict';
/**
* sgFocus - A service to set the focus on the element associated to a specific string
* @memberof SOGo.Common
* @param {string} name - the string identifier of the element
* @see {@link SOGo.Common.sgFocusOn}
* @ngInject
*/
sgFocus.$inject = ['$rootScope', '$timeout'];
function sgFocus($rootScope, $timeout) {
return function(name) {
$timeout(function() {
$rootScope.$broadcast('sgFocusOn', name);
});
}
}
angular
.module('SOGo.Common')
.factory('sgFocus', sgFocus);
})();