From aa98ada141be668da628b48e721d5cb4128b2c70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 26 Apr 2016 14:51:06 +0200 Subject: [PATCH] fix(snapshots): fixed snapshot issue introdiuced yesterday --- public/app/core/directives/plugin_component.ts | 3 +++ public/app/features/panel/panel_ctrl.ts | 7 ++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/public/app/core/directives/plugin_component.ts b/public/app/core/directives/plugin_component.ts index 6708c0315f3..6f693a13d68 100644 --- a/public/app/core/directives/plugin_component.ts +++ b/public/app/core/directives/plugin_component.ts @@ -211,6 +211,9 @@ function pluginDirectiveLoader($compile, datasourceSrv, $rootScope, $q, $http, $ // let a binding digest cycle complete before adding to dom setTimeout(function() { elem.append(child); + scope.$apply(function() { + scope.$broadcast('refresh'); + }); }); } diff --git a/public/app/features/panel/panel_ctrl.ts b/public/app/features/panel/panel_ctrl.ts index 48746e56ff4..76d348d9b1f 100644 --- a/public/app/features/panel/panel_ctrl.ts +++ b/public/app/features/panel/panel_ctrl.ts @@ -44,18 +44,15 @@ export class PanelCtrl { this.pluginName = plugin.name; } - $scope.$on("refresh", () => this.refresh()); - $scope.$on("render", () => this.render()); + $scope.$on("refresh", this.refresh.bind(this)); + $scope.$on("render", this.render.bind(this)); $scope.$on("$destroy", () => this.events.emit('panel-teardown')); } init() { this.calculatePanelHeight(); - this.publishAppEvent('panel-initialized', {scope: this.$scope}); this.events.emit('panel-initialized'); - - this.refresh(); } renderingCompleted() {