diff --git a/guacamole/src/main/webapp/app/client/directives/guacClient.js b/guacamole/src/main/webapp/app/client/directives/guacClient.js index a8bc98e76..4bb273de7 100644 --- a/guacamole/src/main/webapp/app/client/directives/guacClient.js +++ b/guacamole/src/main/webapp/app/client/directives/guacClient.js @@ -260,8 +260,8 @@ angular.module('client').directive('guacClient', [function guacClient() { return; // Get new client instance - var tunnel = guacTunnelFactory.getInstance(); - client = guacClientFactory.getInstance(tunnel); + var tunnel = guacTunnelFactory.getInstance($scope); + client = guacClientFactory.getInstance(tunnel, $scope); // Init display display = client.getDisplay(); diff --git a/guacamole/src/main/webapp/app/client/services/guacClientFactory.js b/guacamole/src/main/webapp/app/client/services/guacClientFactory.js index 2ad5569ae..4eb9f5cdc 100644 --- a/guacamole/src/main/webapp/app/client/services/guacClientFactory.js +++ b/guacamole/src/main/webapp/app/client/services/guacClientFactory.js @@ -33,9 +33,14 @@ angular.module('client').factory('guacClientFactory', ['$rootScope', * provided tunnel. * * @param {Guacamole.Tunnel} tunnel The tunnel to connect through. + * @param {Scope} [$scope] The current scope. If ommitted, the root scope + * will be used. * @returns {Guacamole.Client} A new Guacamole client instance. */ - service.getInstance = function getClientInstance(tunnel) { + service.getInstance = function getClientInstance(tunnel, $scope) { + + // Use root scope if no other scope provided + $scope = $scope || $rootScope; // Instantiate client var guacClient = new Guacamole.Client(tunnel); diff --git a/guacamole/src/main/webapp/app/client/services/guacTunnelFactory.js b/guacamole/src/main/webapp/app/client/services/guacTunnelFactory.js index ead734ee1..1ed476f3e 100644 --- a/guacamole/src/main/webapp/app/client/services/guacTunnelFactory.js +++ b/guacamole/src/main/webapp/app/client/services/guacTunnelFactory.js @@ -32,9 +32,14 @@ angular.module('client').factory('guacTunnelFactory', ['$rootScope', '$window', * Returns a new Guacamole tunnel instance, using an implementation that is * supported by the web browser. * + * @param {Scope} [$scope] The current scope. If ommitted, the root scope + * will be used. * @returns {Guacamole.Tunnel} A new Guacamole tunnel instance. */ - service.getInstance = function getTunnelInstance() { + service.getInstance = function getTunnelInstance($scope) { + + // Use root scope if no other scope provided + $scope = $scope || $rootScope; var tunnel;