diff --git a/public/app/features/org/partials/pluginEdit.html b/public/app/features/org/partials/pluginEdit.html
index d77eb5ebd6c..9276fce277c 100644
--- a/public/app/features/org/partials/pluginEdit.html
+++ b/public/app/features/org/partials/pluginEdit.html
@@ -30,7 +30,7 @@
Cancel
diff --git a/public/app/features/org/plugin_directive.js b/public/app/features/org/plugin_directive.js
index 8862f5580e7..6fd30730264 100644
--- a/public/app/features/org/plugin_directive.js
+++ b/public/app/features/org/plugin_directive.js
@@ -11,13 +11,18 @@ function (angular) {
restrict: 'E',
link: function(scope, elem) {
var directive = 'grafana-plugin-core';
- if (scope.current.module) {
- directive = 'grafana-plugin-'+scope.current.type;
- }
- scope.require([scope.current.module], function () {
- var panelEl = angular.element(document.createElement(directive));
- elem.append(panelEl);
- $compile(panelEl)(scope);
+ //wait for the parent scope to be applied.
+ scope.$watch("current", function(newVal) {
+ if (newVal) {
+ if (newVal.module) {
+ directive = 'grafana-plugin-'+newVal.type;
+ }
+ scope.require([newVal.module], function () {
+ var panelEl = angular.element(document.createElement(directive));
+ elem.append(panelEl);
+ $compile(panelEl)(scope);
+ });
+ }
});
}
};
@@ -28,8 +33,7 @@ function (angular) {
restrict: 'E',
templateUrl: 'app/features/org/partials/pluginConfigCore.html',
transclude: true,
- link: function(scope, elem) {
- console.log("grafana plugin core", scope, elem);
+ link: function(scope) {
scope.update = function() {
//Perform custom save events to the plugins own backend if needed.