mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-302: Merge $evalAsync() focus fix.
This commit is contained in:
@@ -20,7 +20,11 @@
|
|||||||
/**
|
/**
|
||||||
* A directive which allows elements to be manually focused / blurred.
|
* A directive which allows elements to be manually focused / blurred.
|
||||||
*/
|
*/
|
||||||
angular.module('element').directive('guacFocus', ['$parse', function guacFocus($parse) {
|
angular.module('element').directive('guacFocus', ['$injector', function guacFocus($injector) {
|
||||||
|
|
||||||
|
// Required services
|
||||||
|
var $parse = $injector.get('$parse');
|
||||||
|
var $timeout = $injector.get('$timeout');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
@@ -44,7 +48,7 @@ angular.module('element').directive('guacFocus', ['$parse', function guacFocus($
|
|||||||
|
|
||||||
// Set/unset focus depending on value of guacFocus
|
// Set/unset focus depending on value of guacFocus
|
||||||
$scope.$watch(guacFocus, function updateFocus(value) {
|
$scope.$watch(guacFocus, function updateFocus(value) {
|
||||||
$scope.$evalAsync(function updateFocusAsync() {
|
$timeout(function updateFocusAfterRender() {
|
||||||
if (value)
|
if (value)
|
||||||
element.focus();
|
element.focus();
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user