X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/12b9d77ecca3043b65015860359ce447b68fccfb..b936759134f8d2b1a68b19be06de8a3f41f782d8:/apps/workbench/app/assets/javascripts/angular_shim.js diff --git a/apps/workbench/app/assets/javascripts/angular_shim.js b/apps/workbench/app/assets/javascripts/angular_shim.js index a480eaf8ff..5da67285b1 100644 --- a/apps/workbench/app/assets/javascripts/angular_shim.js +++ b/apps/workbench/app/assets/javascripts/angular_shim.js @@ -1,12 +1,17 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + // Compile any new HTML content that was loaded via jQuery.ajax(). -// Currently this only works for tabs because they emit an +// Currently this only works for tabs, and only because they emit an // arv:pane:loaded event after updating the DOM. -$(document).on('arv:pane:loaded', function(event, updatedElement) { - if (updatedElement) { - angular.element(updatedElement).injector().invoke(function($compile) { - var scope = angular.element(updatedElement).scope(); - $compile(updatedElement)(scope); - }); +$(document).on('arv:pane:loaded', function(event, $updatedElement) { + if (angular && $updatedElement && angular.element($updatedElement).injector()) { + angular.element($updatedElement).injector().invoke([ + '$compile', function($compile) { + var scope = angular.element($updatedElement).scope(); + $compile($updatedElement)(scope); + }]); } });