diff --git a/public/app/features/dashboard/all.js b/public/app/features/dashboard/all.js
index f2716979903..9d7cd06019b 100644
--- a/public/app/features/dashboard/all.js
+++ b/public/app/features/dashboard/all.js
@@ -2,11 +2,11 @@ define([
'./dashboardCtrl',
'./dashboardLoaderSrv',
'./dashnav/dashnav',
+ './submenu/submenu',
'./saveDashboardAsCtrl',
'./rowCtrl',
'./shareModalCtrl',
'./shareSnapshotCtrl',
- './submenuCtrl',
'./dashboardSrv',
'./keybindings',
'./viewStateSrv',
diff --git a/public/app/features/dashboard/submenu/submenu.html b/public/app/features/dashboard/submenu/submenu.html
new file mode 100644
index 00000000000..b7bf0e89232
--- /dev/null
+++ b/public/app/features/dashboard/submenu/submenu.html
@@ -0,0 +1,30 @@
+
diff --git a/public/app/features/dashboard/submenu/submenu.ts b/public/app/features/dashboard/submenu/submenu.ts
new file mode 100644
index 00000000000..7e304d88464
--- /dev/null
+++ b/public/app/features/dashboard/submenu/submenu.ts
@@ -0,0 +1,46 @@
+///
+
+import angular from 'angular';
+
+export class SubmenuCtrl {
+ annotations: any;
+ variables: any;
+ dashboard: any;
+
+ constructor(private $rootScope, private templateValuesSrv, private dynamicDashboardSrv) {
+ this.annotations = this.dashboard.templating.list;
+ this.variables = this.dashboard.templating.list;
+ }
+
+ disableAnnotation(annotation) {
+ annotation.enable = !annotation.enable;
+ this.$rootScope.$broadcast('refresh');
+ }
+
+ getValuesForTag(variable, tagKey) {
+ return this.templateValuesSrv.getValuesForTag(variable, tagKey);
+ }
+
+ variableUpdated(variable) {
+ this.templateValuesSrv.variableUpdated(variable).then(() => {
+ this.dynamicDashboardSrv.update(this.dashboard);
+ this.$rootScope.$emit('template-variable-value-updated');
+ this.$rootScope.$broadcast('refresh');
+ });
+ }
+}
+
+export function submenuDirective() {
+ return {
+ restrict: 'E',
+ templateUrl: 'app/features/dashboard/submenu/submenu.html',
+ controller: SubmenuCtrl,
+ bindToController: true,
+ controllerAs: 'ctrl',
+ scope: {
+ dashboard: "=",
+ }
+ };
+}
+
+angular.module('grafana.directives').directive('dashboardSubmenu', submenuDirective);
diff --git a/public/app/features/dashboard/submenuCtrl.js b/public/app/features/dashboard/submenuCtrl.js
deleted file mode 100644
index b1d0dc3ae32..00000000000
--- a/public/app/features/dashboard/submenuCtrl.js
+++ /dev/null
@@ -1,39 +0,0 @@
-define([
- 'angular',
-],
-function (angular) {
- 'use strict';
-
- var module = angular.module('grafana.controllers');
-
- module.controller('SubmenuCtrl', function($scope, $q, $rootScope, templateValuesSrv, dynamicDashboardSrv) {
-
- $scope.init = function() {
- $scope.panel = $scope.pulldown;
- $scope.row = $scope.pulldown;
- $scope.annotations = $scope.dashboard.templating.list;
- $scope.variables = $scope.dashboard.templating.list;
- };
-
- $scope.disableAnnotation = function (annotation) {
- annotation.enable = !annotation.enable;
- $rootScope.$broadcast('refresh');
- };
-
- $scope.getValuesForTag = function(variable, tagKey) {
- return templateValuesSrv.getValuesForTag(variable, tagKey);
- };
-
- $scope.variableUpdated = function(variable) {
- templateValuesSrv.variableUpdated(variable).then(function() {
- dynamicDashboardSrv.update($scope.dashboard);
- $rootScope.$emit('template-variable-value-updated');
- $rootScope.$broadcast('refresh');
- });
- };
-
- $scope.init();
-
- });
-
-});
diff --git a/public/app/partials/dashboard.html b/public/app/partials/dashboard.html
index 4c5336b88f6..9d20da3d7b4 100644
--- a/public/app/partials/dashboard.html
+++ b/public/app/partials/dashboard.html
@@ -6,8 +6,7 @@
-
-
+
diff --git a/public/app/partials/submenu.html b/public/app/partials/submenu.html
deleted file mode 100644
index 485186696c3..00000000000
--- a/public/app/partials/submenu.html
+++ /dev/null
@@ -1,30 +0,0 @@
-
diff --git a/public/views/index.html b/public/views/index.html
index a3e21da4a04..2d05f414658 100644
--- a/public/views/index.html
+++ b/public/views/index.html
@@ -27,6 +27,7 @@
+