diff --git a/angular-bootstrap-checkbox.js b/angular-bootstrap-checkbox.js index 1fba9ce..b1ade59 100644 --- a/angular-bootstrap-checkbox.js +++ b/angular-bootstrap-checkbox.js @@ -6,7 +6,7 @@ angular.module("ui.checkbox", []).directive("checkbox", function() { require: "ngModel", restrict: "E", replace: "true", - template: "", link: function(scope, elem, attrs, modelCtrl) { @@ -62,15 +62,13 @@ angular.module("ui.checkbox", []).directive("checkbox", function() { }, true); // On click swap value and trigger onChange function - elem.bind("click", function() { - scope.$apply(function() { - if(modelCtrl.$modelValue === falseValue) { - modelCtrl.$setViewValue(trueValue); - } else { - modelCtrl.$setViewValue(falseValue); - } - }); - }); + scope.handleClick = function() { + if(modelCtrl.$modelValue === falseValue) { + modelCtrl.$setViewValue(trueValue); + } else { + modelCtrl.$setViewValue(falseValue); + } + } } }; }); \ No newline at end of file