true or false to set the checkbox to checked or unchecked.
-@param {string} input-id Set the id of the checkbox.
+@param {string} inputId Set the id of the checkbox.
@param {string} value Set the value of the checkbox.
@param {string} name Set the name of the checkbox.
@param {string} text Set the text for the checkbox label.
-@param {string} server-validation-field Set the val-server-field of the checkbox.
+@param {string} serverValidationField Set the val-server-field of the checkbox.
@param {boolean} disabled Set the checkbox to be disabled.
@param {boolean} required Set the checkbox to be required.
-@param {string} on-change Callback when the value of the checkbox changed by interaction.
+@param {callback} onChange Callback when the value of the checkbox change by interaction.
**/
@@ -40,8 +40,8 @@
function UmbCheckboxController($timeout) {
var vm = this;
-
- vm.callOnChange = function() {
+
+ if (vm.onChange) {
$timeout(function() {
vm.onChange({model:vm.model, value:vm.value});
}, 0);
@@ -49,7 +49,6 @@
}
-
var component = {
templateUrl: 'views/components/forms/umb-checkbox.html',
controller: UmbCheckboxController,
@@ -63,7 +62,7 @@
serverValidationField: "@",
disabled: "<",
required: "<",
- onChange: "&"
+ onChange: "&?"
}
};
diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbradiobutton.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbradiobutton.directive.js
index 351ba2fee2..933107527b 100644
--- a/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbradiobutton.directive.js
+++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbradiobutton.directive.js
@@ -27,31 +27,40 @@
@param {string} text Set the text for the radiobutton label.
@param {boolean} disabled Set the radiobutton to be disabled.
@param {boolean} required Set the radiobutton to be required.
+@param {callback} onChange Callback when the value of the radiobutton change by interaction.
**/
(function () {
'use strict';
- function RadiobuttonDirective() {
- var directive = {
- restrict: 'E',
- replace: true,
- templateUrl: 'views/components/forms/umb-radiobutton.html',
- scope: {
- model: "=",
- value: "@",
- name: "@",
- text: "@",
- disabled: "=",
- required: "="
- }
- };
+ function UmbRadiobuttonController($timeout) {
- return directive;
+ var vm = this;
+ if (vm.onChange) {
+ $timeout(function () {
+ vm.onChange({ model: vm.model, value: vm.value });
+ }, 0);
+ }
+
}
- angular.module('umbraco.directives').directive('umbRadiobutton', RadiobuttonDirective);
+ var component = {
+ templateUrl: 'views/components/forms/umb-radiobutton.html',
+ controller: UmbRadiobuttonController,
+ controllerAs: 'vm',
+ bindings: {
+ model: "=",
+ value: "@",
+ name: "@",
+ text: "@",
+ disabled: "=",
+ required: "=",
+ onChange: "&?"
+ }
+ };
+
+ angular.module('umbraco.directives').component('umbRadiobutton', component);
})();
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 d40263c6b6..2f90905c7d 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
@@ -1,4 +1,4 @@
-