From 8c28172efcae62eafbf1865180123667d900a982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Thu, 7 Mar 2019 12:57:10 +0100 Subject: [PATCH 1/5] changed umb-checkbox model to be the boolean property, not a object containing a checked property. This means that the on-change callback will recive the model and the value instead. --- .../components/forms/umbcheckbox.directive.js | 13 ++++++++++++- .../src/views/components/forms/umb-checkbox.html | 4 ++-- .../checkboxlist/checkboxlist.controller.js | 16 ++++++---------- .../checkboxlist/checkboxlist.html | 2 +- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbcheckbox.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbcheckbox.directive.js index d44ca36a5a..e858ecfdc7 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbcheckbox.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbcheckbox.directive.js @@ -35,6 +35,16 @@ 'use strict'; function CheckboxDirective() { + + function link(scope, el, attr, ctrl) { + + scope.callOnChange = function() { + scope.onChange({model:scope.model, value:scope.value}); + } + + } + + var directive = { restrict: 'E', replace: true, @@ -47,7 +57,8 @@ disabled: "=", required: "=", onChange: "&" - } + }, + link: link }; return directive; diff --git a/src/Umbraco.Web.UI.Client/src/views/components/forms/umb-checkbox.html b/src/Umbraco.Web.UI.Client/src/views/components/forms/umb-checkbox.html index b11e682da8..0b90a62e0b 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/forms/umb-checkbox.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/forms/umb-checkbox.html @@ -2,10 +2,10 @@ + ng-change="callOnChange()"/>