Browse Source

fix(snapshots): fixed snapshot issue introdiuced yesterday

Torkel Ödegaard 9 years ago
parent
commit
aa98ada141

+ 3 - 0
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');
+      });
     });
   }
 

+ 2 - 5
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() {