diff --git a/public/app/core/core.ts b/public/app/core/core.ts
index 2580fc18e96..47c167c5689 100644
--- a/public/app/core/core.ts
+++ b/public/app/core/core.ts
@@ -25,5 +25,6 @@ import 'app/core/controllers/all';
import 'app/core/services/all';
import 'app/core/routes/all';
import './filters/filters';
+import coreModule from './core_module';
-export {arrayJoin};
+export {arrayJoin, coreModule};
diff --git a/public/app/core/services/dynamic_directive_srv.ts b/public/app/core/services/dynamic_directive_srv.ts
index cb7bad5b75a..51c97290914 100644
--- a/public/app/core/services/dynamic_directive_srv.ts
+++ b/public/app/core/services/dynamic_directive_srv.ts
@@ -9,25 +9,31 @@ class DynamicDirectiveSrv {
constructor(private $compile, private $parse) {}
addDirective(element, name, scope) {
+ var child = angular.element(document.createElement(name));
+ this.$compile(child)(scope);
+
element.empty();
- element.append(angular.element(document.createElement(name)));
- this.$compile(element)(scope);
+ element.append(child);
}
create(options) {
let directiveDef = {
restrict: 'E',
scope: options.scope,
- link: function(scope, elem) {
+ link: (scope, elem, attrs) => {
options.directive(scope).then(directiveInfo => {
if (!directiveInfo) {
return;
}
- if (directiveInfo.fn.hasBeenRegistered) {
- coreModule.directive(directiveInfo.name, directiveInfo.fn);
- directiveInfo.fn.hasBeenRegistered = true;
+ if (!directiveInfo.fn.registered) {
+ coreModule.directive(attrs.$normalize(directiveInfo.name), directiveInfo.fn);
+ directiveInfo.fn.registered = true;
}
+
+ this.addDirective(elem, directiveInfo.name, scope);
+ }).catch(function(err) {
+ console.log('Dynamic directive load error: ', err);
});
}
};
diff --git a/public/app/features/apps/config_loader.ts b/public/app/features/apps/config_loader.ts
index f37d0145046..5e571987d25 100644
--- a/public/app/features/apps/config_loader.ts
+++ b/public/app/features/apps/config_loader.ts
@@ -11,8 +11,8 @@ function appConfigLoader(dynamicDirectiveSrv) {
directive: scope => {
return System.import(scope.appModel.module).then(function(appModule) {
return {
- name: 'appConfigLoader' + scope.appModel.appId,
- fn: scope.appModel.directives.configView,
+ name: 'app-config-' + scope.appModel.appId,
+ fn: appModule.configView,
};
});
},
diff --git a/public/app/features/apps/partials/edit.html b/public/app/features/apps/partials/edit.html
index 79373c56fe6..e1a26bbd5aa 100644
--- a/public/app/features/apps/partials/edit.html
+++ b/public/app/features/apps/partials/edit.html
@@ -96,8 +96,6 @@
-