diff --git a/public/app/directives/valueSelectDropdown.js b/public/app/directives/valueSelectDropdown.js index 14791eba0f3..f1763514f25 100644 --- a/public/app/directives/valueSelectDropdown.js +++ b/public/app/directives/valueSelectDropdown.js @@ -34,7 +34,7 @@ function (angular, app, _) { var tag = { text: value, selected: false }; _.each(vm.variable.current.tags, function(tagObj) { if (tagObj.text === value) { - tag.selected = true; + tag = tagObj; } }); return tag; diff --git a/public/test/specs/valueSelectDropdown-specs.js b/public/test/specs/valueSelectDropdown-specs.js index 9fadb893467..f329e3f6738 100644 --- a/public/test/specs/valueSelectDropdown-specs.js +++ b/public/test/specs/valueSelectDropdown-specs.js @@ -138,7 +138,7 @@ function () { describe("Given variable with selected tags", function() { beforeEach(function() { ctrl.variable = { - current: {text: 'server-1', value: 'server-1', tags: [{text: 'key1'}] }, + current: {text: 'server-1', value: 'server-1', tags: [{text: 'key1', selected: true}] }, options: [ {text: 'server-1', value: 'server-1'}, {text: 'server-2', value: 'server-2'},