From 75994aa2d2c29b38a0323797666162ce429107b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabi=C3=ABn?= Date: Wed, 2 Mar 2016 16:26:13 +0100 Subject: [PATCH] Added variable, so custom event knows if the checkbox was checked or unchecked --- checklist-model.js | 2 +- docs/blocks/event/ctrl.js | 9 ++++++++- docs/blocks/event/view.html | 2 +- index.html | 22 ++++++++++++++++++---- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/checklist-model.js b/checklist-model.js index de3f64f..a7946e5 100644 --- a/checklist-model.js +++ b/checklist-model.js @@ -86,7 +86,7 @@ angular.module('checklist-model', []) setValueInChecklistModel(getChecklistValue(), newValue); if (checklistChange) { - checklistChange(scope); + checklistChange(scope, { "$checked": newValue }); } }); diff --git a/docs/blocks/event/ctrl.js b/docs/blocks/event/ctrl.js index 3333787..8ab669d 100644 --- a/docs/blocks/event/ctrl.js +++ b/docs/blocks/event/ctrl.js @@ -7,7 +7,14 @@ app.controller('Ctrl5', function($scope) { }; $scope.testValue = 'Im not changed yet!'; - $scope.imChanged = function(){ + $scope.imChanged = function(checked, key) { + if (checked) { + console.log(key + " activated") + } + else { + console.log(key + " deactivated") + } + $scope.testValue = $scope.user.roles.join(','); } $scope.shouldChange = function(key){ diff --git a/docs/blocks/event/view.html b/docs/blocks/event/view.html index 4ad4bb3..4d0809a 100644 --- a/docs/blocks/event/view.html +++ b/docs/blocks/event/view.html @@ -1,3 +1,3 @@ \ No newline at end of file diff --git a/index.html b/index.html index c1fbe6a..51081f4 100644 --- a/index.html +++ b/index.html @@ -909,7 +909,7 @@

Event

demo