From f768808b6ee7952ca7ac3c5ae2bcc4d07422cc07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 23 Feb 2019 08:59:00 +0100 Subject: [PATCH] Fixed value dropdown not updating when it's current value updates, fixes #15566 --- .../app/core/directives/value_select_dropdown.ts | 16 ++++++++-------- .../dashboard/components/SubMenu/template.html | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/public/app/core/directives/value_select_dropdown.ts b/public/app/core/directives/value_select_dropdown.ts index a75ecd46ad0..0df1b2758be 100644 --- a/public/app/core/directives/value_select_dropdown.ts +++ b/public/app/core/directives/value_select_dropdown.ts @@ -240,7 +240,7 @@ export class ValueSelectDropdownCtrl { /** @ngInject */ export function valueSelectDropdown($compile, $window, $timeout, $rootScope) { return { - scope: { variable: '=', onUpdated: '&' }, + scope: { dashboard: '=', variable: '=', onUpdated: '&' }, templateUrl: 'public/app/partials/valueSelectDropdown.html', controller: 'ValueSelectDropdownCtrl', controllerAs: 'vm', @@ -288,13 +288,13 @@ export function valueSelectDropdown($compile, $window, $timeout, $rootScope) { } }); - const cleanUp = $rootScope.$on('template-variable-value-updated', () => { - scope.vm.updateLinkText(); - }); - - scope.$on('$destroy', () => { - cleanUp(); - }); + scope.vm.dashboard.on( + 'template-variable-value-updated', + () => { + scope.vm.updateLinkText(); + }, + scope + ); scope.vm.init(); }, diff --git a/public/app/features/dashboard/components/SubMenu/template.html b/public/app/features/dashboard/components/SubMenu/template.html index 1ccbfcc915c..fd52deaf403 100644 --- a/public/app/features/dashboard/components/SubMenu/template.html +++ b/public/app/features/dashboard/components/SubMenu/template.html @@ -4,7 +4,7 @@ - +