diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/buttons/umbtoggle.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/buttons/umbtoggle.directive.js index 6f0e03cc5a..7a5eb9fc29 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/buttons/umbtoggle.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/buttons/umbtoggle.directive.js @@ -82,7 +82,7 @@ // Must wait until the current digest cycle is finished before we emit this event on init, // otherwise other property editors might not yet be ready to receive the event $timeout(function () { - eventsService.emit("toggleValue", { value: scope.checked }); + eventsService.emit("toggleValue", { value: scope.checked, inputId: scope.inputId }); }, 100); } @@ -122,7 +122,7 @@ } if (scope.onClick) { - eventsService.emit("toggleValue", { value: !scope.checked }); + eventsService.emit("toggleValue", { value: !scope.checked, inputId: scope.inputId }); scope.onClick(); } }; diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/colorpicker/multicolorpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/colorpicker/multicolorpicker.controller.js index c81df25c76..c69fc60a82 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/colorpicker/multicolorpicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/colorpicker/multicolorpicker.controller.js @@ -1,7 +1,7 @@ -angular.module("umbraco").controller("Umbraco.PrevalueEditors.MultiColorPickerController", +angular.module("umbraco").controller("Umbraco.PrevalueEditors.MultiColorPickerController", function ($scope, angularHelper, $element, eventsService) { - var vm = this; + const vm = this; vm.add = add; vm.remove = remove; @@ -15,10 +15,10 @@ vm.labelEnabled = false; vm.editItem = null; - //NOTE: We need to make each color an object, not just a string because you cannot 2-way bind to a primitive. - var defaultColor = "000000"; - var defaultLabel = null; - + // NOTE: We need to make each color an object, not just a string because you cannot 2-way bind to a primitive. + const defaultColor = "000000"; + const defaultLabel = null; + $scope.newColor = defaultColor; $scope.newLabel = defaultLabel; $scope.hasError = false; @@ -48,15 +48,20 @@ } }); } + var evts = []; evts.push(eventsService.on("toggleValue", function (e, args) { - vm.labelEnabled = args.value; + if (args.inputId === "useLabel") { + vm.labelEnabled = args.value; + } })); + $scope.$on('$destroy', function () { for (var e in evts) { eventsService.unsubscribe(evts[e]); } }); + if (!Utilities.isArray($scope.model.value)) { //make an array from the dictionary var items = [];